Skip to content

Commit

Permalink
feat(debugger): support . (dot) as an argument of the l(ist) command …
Browse files Browse the repository at this point in the history
…in ipdb (#14121)

Support `.` as an argument of the `l(ist)` command in the debugger. This
works in pdb but not work in ipdb right now (see [the relevant
issue](gotcha/ipdb#203)).
  • Loading branch information
Carreau committed Aug 28, 2023
2 parents 124de52 + b8a45b5 commit 03eaa61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IPython/core/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def do_list(self, arg):
"""
self.lastcmd = 'list'
last = None
if arg:
if arg and arg != ".":
try:
x = eval(arg, {}, {})
if type(x) == type(()):
Expand All @@ -655,7 +655,7 @@ def do_list(self, arg):
except:
print('*** Error in argument:', repr(arg), file=self.stdout)
return
elif self.lineno is None:
elif self.lineno is None or arg == ".":
first = max(1, self.curframe.f_lineno - 5)
else:
first = self.lineno + 1
Expand Down

0 comments on commit 03eaa61

Please sign in to comment.