[Python-checkins] r73918 - python/branches/py3k/Lib/pdb.py

amaury.forgeotdarc python-checkins at python.org
Fri Jul 10 01:00:40 CEST 2009


Author: amaury.forgeotdarc
Date: Fri Jul 10 01:00:40 2009
New Revision: 73918

Log:
#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)".


Modified:
   python/branches/py3k/Lib/pdb.py

Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py	(original)
+++ python/branches/py3k/Lib/pdb.py	Fri Jul 10 01:00:40 2009
@@ -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


More information about the Python-checkins mailing list