]> granicus.if.org Git - python/commitdiff
Repair a bad translation of the exec statement.
authorGeorg Brandl <georg@python.org>
Wed, 12 Sep 2007 19:44:18 +0000 (19:44 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 12 Sep 2007 19:44:18 +0000 (19:44 +0000)
Fixes #1038: pdb command line invocation fails.

Lib/pdb.py

index 8a52778f86eceacb3becef6de15a5835e57169f9..3d79b4da1c4b5a83048e1e693fc559325617f32f 100755 (executable)
@@ -1166,12 +1166,8 @@ see no sign that the breakpoint was reached.
         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