From 7dd803a4d43f8c2a7b3aa69c8f934f8a497afc60 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 12 Sep 2007 19:44:18 +0000 Subject: Repair a bad translation of the exec statement. Fixes #1038: pdb command line invocation fails. --- Lib/pdb.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/pdb.py b/Lib/pdb.py index 8a52778..3d79b4d 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -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 -- cgit v0.12