Skip to content

Commit a91a94b

Browse files
committed
#4179: In pdb, allow "list ." as a command to return to the currently debugged line.
1 parent b3b96bd commit a91a94b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/pdb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
List source code for the current file.
161161
Without arguments, list 11 lines around the current line
162162
or continue the previous listing.
163+
With . as argument, list 11 lines around the current line.
163164
With one argument, list 11 lines starting at that line.
164165
With two arguments, list the given range;
165166
if the second argument is less than the first, it is a count.
@@ -997,7 +998,7 @@ def do_pp(self, arg):
997998
def do_list(self, arg):
998999
self.lastcmd = 'list'
9991000
last = None
1000-
if arg:
1001+
if arg and arg != '.':
10011002
try:
10021003
x = eval(arg, {}, {})
10031004
if type(x) == type(()):
@@ -1012,7 +1013,7 @@ def do_list(self, arg):
10121013
except:
10131014
print('*** Error in argument:', repr(arg), file=self.stdout)
10141015
return
1015-
elif self.lineno is None:
1016+
elif self.lineno is None or arg == '.':
10161017
first = max(1, self.curframe.f_lineno - 5)
10171018
else:
10181019
first = self.lineno + 1

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ C-API
475475
Library
476476
-------
477477

478+
- Issue #4179: In pdb, allow "list ." as a command to return to the
479+
currently debugged line.
480+
478481
- Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *'
479482
entries, consider the first one.
480483

0 commit comments

Comments
 (0)