Commit a91a94b7 authored by Georg Brandl's avatar Georg Brandl

#4179: In pdb, allow "list ." as a command to return to the currently debugged line.

parent b3b96bd5
...@@ -160,6 +160,7 @@ l(ist) [first [,last]] ...@@ -160,6 +160,7 @@ l(ist) [first [,last]]
List source code for the current file. List source code for the current file.
Without arguments, list 11 lines around the current line Without arguments, list 11 lines around the current line
or continue the previous listing. or continue the previous listing.
With . as argument, list 11 lines around the current line.
With one argument, list 11 lines starting at that line. With one argument, list 11 lines starting at that line.
With two arguments, list the given range; With two arguments, list the given range;
if the second argument is less than the first, it is a count. if the second argument is less than the first, it is a count.
...@@ -997,7 +998,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): ...@@ -997,7 +998,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
def do_list(self, arg): def do_list(self, arg):
self.lastcmd = 'list' self.lastcmd = 'list'
last = None last = None
if arg: if arg and arg != '.':
try: try:
x = eval(arg, {}, {}) x = eval(arg, {}, {})
if type(x) == type(()): if type(x) == type(()):
...@@ -1012,7 +1013,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): ...@@ -1012,7 +1013,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
except: except:
print('*** Error in argument:', repr(arg), file=self.stdout) print('*** Error in argument:', repr(arg), file=self.stdout)
return return
elif self.lineno is None: elif self.lineno is None or arg == '.':
first = max(1, self.curframe.f_lineno - 5) first = max(1, self.curframe.f_lineno - 5)
else: else:
first = self.lineno + 1 first = self.lineno + 1
......
...@@ -475,6 +475,9 @@ C-API ...@@ -475,6 +475,9 @@ C-API
Library Library
------- -------
- Issue #4179: In pdb, allow "list ." as a command to return to the
currently debugged line.
- Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *' - Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *'
entries, consider the first one. entries, consider the first one.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment