From: Georg Brandl Date: Thu, 13 Aug 2009 07:50:57 +0000 (+0000) Subject: #6126: fix pdb stepping and breakpoints by giving the executed code the correct filen... X-Git-Tag: v3.2a1~2695 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d07ac6402422abbc54215478e042bbb009148cf9;p=python #6126: fix pdb stepping and breakpoints by giving the executed code the correct filename; this used execfile() in 2.x which did this automatically. --- diff --git a/Lib/pdb.py b/Lib/pdb.py index d379d1a9ab..e272f2ebb3 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -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 diff --git a/Misc/NEWS b/Misc/NEWS index 040bef785e..e1156952cd 100644 --- 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