From a63505437ac34aac17faadf0d49e322fe89c954a Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Thu, 9 Jul 2009 23:00:40 +0000 Subject: [PATCH] #6323: pdb doesn't deal well with SyntaxErrors. It seems necessary to keep two layers of 'exec' (one in Bdb.run, one in Pdb._runscript); this allows the tracing function to be active when the inner 'exec' runs and tries to compile the real code. This partially revert r58127, the net effet of the two changes is to replace "exec('%s')" with "exec(%r)". --- Lib/pdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/pdb.py b/Lib/pdb.py index 23bc6dfa16b..d379d1a9abd 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -1211,7 +1211,7 @@ def _runscript(self, filename): 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