summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-30 07:14:01 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-30 07:14:01 (GMT)
commita91a94b7c054a01b26bc76a1f3ccaefc6395f077 (patch)
tree15070606649b7768aefa12e923e9f22d54b16286 /Lib/pdb.py
parentb3b96bd52034731c393b8b364813ec5987fe2309 (diff)
downloadcpython-a91a94b7c054a01b26bc76a1f3ccaefc6395f077.zip
cpython-a91a94b7c054a01b26bc76a1f3ccaefc6395f077.tar.gz
cpython-a91a94b7c054a01b26bc76a1f3ccaefc6395f077.tar.bz2
#4179: In pdb, allow "list ." as a command to return to the currently debugged line.
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 5b12ffa..feca2b3 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -160,6 +160,7 @@ l(ist) [first [,last]]
List source code for the current file.
Without arguments, list 11 lines around the current line
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 two arguments, list the given range;
if the second argument is less than the first, it is a count.
@@ -997,7 +998,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
def do_list(self, arg):
self.lastcmd = 'list'
last = None
- if arg:
+ if arg and arg != '.':
try:
x = eval(arg, {}, {})
if type(x) == type(()):
@@ -1012,7 +1013,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
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