Skip to content

Commit

Permalink
Add __debuggerskip__ as special local
Browse files Browse the repository at this point in the history
__debuggerskip__ is a special variable used by IPython, similar to
__tracebackhide__.
  • Loading branch information
Daniel Li authored and jayvdb committed Feb 14, 2024
1 parent 881ed2f commit 5d192ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyflakes/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class FunctionScope(Scope):
"""
usesLocals = False
alwaysUsed = {'__tracebackhide__', '__traceback_info__',
'__traceback_supplement__'}
'__traceback_supplement__', '__debuggerskip__'}

def __init__(self):
super().__init__()
Expand Down
10 changes: 10 additions & 0 deletions pyflakes/test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,16 @@ def helper():
__tracebackhide__ = True
""")

def test_debuggerskipSpecialVariable(self):
"""
Do not warn about unused local variable __debuggerskip__, which is
a special variable for IPython.
"""
self.flakes("""
def helper():
__debuggerskip__ = True
""")

def test_ifexp(self):
"""
Test C{foo if bar else baz} statements.
Expand Down

0 comments on commit 5d192ce

Please sign in to comment.