[Python-checkins] r83035 - in python/branches/py3k: Lib/trace.py Misc/NEWS Misc/maintainers.rst

alexander.belopolsky python-checkins at python.org
Wed Jul 21 19:43:43 CEST 2010


Author: alexander.belopolsky
Date: Wed Jul 21 19:43:42 2010
New Revision: 83035

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


Modified:
   python/branches/py3k/Lib/trace.py
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Misc/maintainers.rst

Modified: python/branches/py3k/Lib/trace.py
==============================================================================
--- python/branches/py3k/Lib/trace.py	(original)
+++ python/branches/py3k/Lib/trace.py	Wed Jul 21 19:43:42 2010
@@ -797,12 +797,9 @@
                   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:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Wed Jul 21 19:43:42 2010
@@ -473,6 +473,9 @@
 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.
 

Modified: python/branches/py3k/Misc/maintainers.rst
==============================================================================
--- python/branches/py3k/Misc/maintainers.rst	(original)
+++ python/branches/py3k/Misc/maintainers.rst	Wed Jul 21 19:43:42 2010
@@ -212,7 +212,7 @@
 tkinter             gpolo
 token               georg.brandl
 tokenize
-trace
+trace               alexander.belopolsky
 traceback           georg.brandl
 tty
 turtle              gregorlingl


More information about the Python-checkins mailing list