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

georg.brandl python-3000-checkins at python.org
Wed Sep 12 21:44:18 CEST 2007


Author: georg.brandl
Date: Wed Sep 12 21:44:18 2007
New Revision: 58127

Modified:
   python/branches/py3k/Lib/pdb.py
Log:
Repair a bad translation of the exec statement.
Fixes #1038: pdb command line invocation fails.


Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py	(original)
+++ python/branches/py3k/Lib/pdb.py	Wed Sep 12 21:44:18 2007
@@ -1166,12 +1166,8 @@
         self._wait_for_mainpyfile = 1
         self.mainpyfile = self.canonic(filename)
         self._user_requested_quit = 0
-        fp = open(filename)
-        try:
-            script = fp.read()
-        finally:
-            fp.close()
-        statement = 'exec("%s")' % script
+        with open(filename) as fp:
+            statement = fp.read()
         self.run(statement)
 
 # Simplified interface


More information about the Python-3000-checkins mailing list