Amaury Forgeot d'Arc <amaur...@gmail.com> added the comment: Thanks for the test case. It appears that 2.7 actually calls exec("execfile(filename)"), when 3.1 directly calls exec(file_content).
The indirection seems necessary: the SyntaxError is detected by the pdb trace function; but this function has to run somehow... With the patch below, pdb now runs exec("exec(file_content)"). I'm not sure how to write unit tests for pdb. I don't know if it will be accepted for 3.1 final. Index: Lib/pdb.py =================================================================== --- Lib/pdb.py (revision 73505) +++ Lib/pdb.py (working copy) @@ -1211,7 +1211,7 @@ self.mainpyfile = self.canonic(filename) self._user_requested_quit = 0 with open(filename) as fp: - statement = fp.read() + statement = "exec(%r)" % (fp.read(),) self.run(statement) # Simplified interface ---------- keywords: +needs review, patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6323> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com