From 03eaa6182b5ed10e457f10ac43494c467724aa46 2023-08-28 08:44:03 From: Matthias Bussonnier Date: 2023-08-28 08:44:03 Subject: [PATCH] feat(debugger): support . (dot) as an argument of the l(ist) command 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](https://github.com/gotcha/ipdb/issues/203)). --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index c8082e3..5964d02 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -640,7 +640,7 @@ class Pdb(OldPdb): """ self.lastcmd = 'list' last = None - if arg: + if arg and arg != ".": try: x = eval(arg, {}, {}) if type(x) == type(()): @@ -655,7 +655,7 @@ class Pdb(OldPdb): 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