]> granicus.if.org Git - python/commitdiff
#6126: fix pdb stepping and breakpoints by giving the executed code the correct filen...
authorGeorg Brandl <georg@python.org>
Thu, 13 Aug 2009 07:50:57 +0000 (07:50 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 13 Aug 2009 07:50:57 +0000 (07:50 +0000)
Lib/pdb.py
Misc/NEWS

index d379d1a9abd765f6977b2a842b1ac558c2e69cf4..e272f2ebb323e1604937645b7632ee484339fc98 100755 (executable)
@@ -1210,8 +1210,9 @@ see no sign that the breakpoint was reached.
         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
index 040bef785e5d60c66453125ef8d975635a81a13d..e1156952cd8fa499774658384b22bda4e1fcff67 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -169,6 +169,8 @@ Core and Builtins
 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