]> granicus.if.org Git - python/commitdiff
Merged revisions 83035 via svnmerge from
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>
Wed, 21 Jul 2010 17:50:34 +0000 (17:50 +0000)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>
Wed, 21 Jul 2010 17:50:34 +0000 (17:50 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83035 | alexander.belopolsky | 2010-07-21 13:43:42 -0400 (Wed, 21 Jul 2010) | 3 lines

  Issue #9323: Fixed a bug in trace.py that resulted in loosing the name
  of the script being traced.  Patch by Eli Bendersky.
........

Lib/trace.py
Misc/NEWS
Misc/maintainers.rst

index c0cca9d06076983cb8a6c8c51e2c958a913992e3..49ad7a8cb78ce8b0fd0015a769e493a74379ce7f 100644 (file)
@@ -797,12 +797,9 @@ def main(argv=None):
                   ignoredirs=ignore_dirs, infile=counts_file,
                   outfile=counts_file, timing=timing)
         try:
-            fp = open(progname)
-            try:
-                script = fp.read()
-            finally:
-                fp.close()
-            t.run('exec(%r)' % (script,))
+            with open(progname) as fp:
+                code = compile(fp.read(), progname, 'exec')
+            t.run(code)
         except IOError as err:
             _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err))
         except SystemExit:
index 57998e371f0c1a62c29fe0b28a016177f15a9c37..7f3f0e1bd73fe6d7ccd1cd98c2746376e4601f8c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -78,6 +78,9 @@ C-API
 Library
 -------
 
+- Issue #9323: Fixed a bug in trace.py that resulted in loosing the
+  name of the script being traced.  Patch by Eli Bendersky.
+
 - Issue #9282: Fixed --listfuncs option of trace.py.  Thanks Eli
   Bendersky for the patch.
 
index 7795eb06e79aed56e8f17beeb7926143ebf4a5c9..b9984b118e8b4463891ef3c231e5d5d97b99f22b 100644 (file)
@@ -212,7 +212,7 @@ timeit
 tkinter             gpolo
 token               georg.brandl
 tokenize
-trace
+trace               alexander.belopolsky
 traceback           georg.brandl
 tty
 turtle              gregorlingl