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

georg.brandl python-checkins at python.org
Thu Aug 13 09:50:58 CEST 2009


Author: georg.brandl
Date: Thu Aug 13 09:50:57 2009
New Revision: 74366

Log:
#6126: fix pdb stepping and breakpoints by giving the executed code the correct filename; this used execfile() in 2.x which did this automatically.

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	Thu Aug 13 09:50:57 2009
@@ -1210,8 +1210,9 @@
         self._wait_for_mainpyfile = 1
         self.mainpyfile = self.canonic(filename)
         self._user_requested_quit = 0
-        with open(filename) as fp:
-            statement = "exec(%r)" % (fp.read(),)
+        with open(filename, "rb") as fp:
+            statement = "exec(compile(%r, %r, 'exec'))" % \
+                        (fp.read(), self.mainpyfile)
         self.run(statement)
 
 # Simplified interface

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Aug 13 09:50:57 2009
@@ -169,6 +169,8 @@
 Library
 -------
 
+- Issue #6126: Fixed pdb command-line usage.
+
 - Issue #6314: logging: performs extra checks on the "level" argument.
 
 - Issue #6274: Fixed possible file descriptors leak in subprocess.py


More information about the Python-checkins mailing list