Issue #9323: Fixed a bug in trace.py that resulted in loosing the name

of the script being traced.  Patch by Eli Bendersky.
This commit is contained in:
Alexander Belopolsky 2010-07-21 17:43:42 +00:00
parent 8cb6dbf1b9
commit 3f8ecab589
3 changed files with 7 additions and 7 deletions

View File

@ -797,12 +797,9 @@ def main(argv=None):
ignoredirs=ignore_dirs, infile=counts_file, ignoredirs=ignore_dirs, infile=counts_file,
outfile=counts_file, timing=timing) outfile=counts_file, timing=timing)
try: try:
fp = open(progname) with open(progname) as fp:
try: code = compile(fp.read(), progname, 'exec')
script = fp.read() t.run(code)
finally:
fp.close()
t.run('exec(%r)' % (script,))
except IOError as err: except IOError as err:
_err_exit("Cannot run file %r because: %s" % (sys.argv[0], err)) _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err))
except SystemExit: except SystemExit:

View File

@ -473,6 +473,9 @@ C-API
Library 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 - Issue #9282: Fixed --listfuncs option of trace.py. Thanks Eli
Bendersky for the patch. Bendersky for the patch.

View File

@ -212,7 +212,7 @@ timeit
tkinter gpolo tkinter gpolo
token georg.brandl token georg.brandl
tokenize tokenize
trace trace alexander.belopolsky
traceback georg.brandl traceback georg.brandl
tty tty
turtle gregorlingl turtle gregorlingl