[Python-checkins] r83260 - in python/branches/py3k: Lib/pdb.py Misc/NEWS

georg.brandl python-checkins at python.org
Fri Jul 30 09:14:01 CEST 2010


Author: georg.brandl
Date: Fri Jul 30 09:14:01 2010
New Revision: 83260

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

Modified:
   python/branches/py3k/Lib/pdb.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py	(original)
+++ python/branches/py3k/Lib/pdb.py	Fri Jul 30 09:14:01 2010
@@ -160,6 +160,7 @@
         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 @@
     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 @@
             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

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Fri Jul 30 09:14:01 2010
@@ -475,6 +475,9 @@
 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: *'
   entries, consider the first one.
 


More information about the Python-checkins mailing list