homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients eli.bendersky, terry.reedy
Date 2010年07月17日.08:38:37
SpamBayes Score 6.585987e-05
Marked as misclassified No
Message-id <1279355920.89.0.901837761289.issue9282@psf.upfronthosting.co.za>
In-reply-to
Content
Running:
py3d -m trace -C . --listfuncs trace_target.py
Where py3d points to a freshly compiled Python 3 trunk interpreter, results in an error: 
functions called:
Traceback (most recent call last):
 File "/home/eliben/python_src/eliben-py3k/Lib/runpy.py", line 160, in _run_module_as_main
 "__main__", fname, loader, pkg_name)
 File "/home/eliben/python_src/eliben-py3k/Lib/runpy.py", line 73, in _run_code
 exec(code, run_globals)
 File "/home/eliben/python_src/eliben-py3k/Lib/trace.py", line 816, in <module>
 main()
 File "/home/eliben/python_src/eliben-py3k/Lib/trace.py", line 813, in main
 results.write_results(missing, summary=summary, coverdir=coverdir)
 File "/home/eliben/python_src/eliben-py3k/Lib/trace.py", line 260, in write_results
 for filename, modulename, funcname in sorted(calls.keys()):
NameError: global name 'calls' is not defined
--------------
With Python 2.x it runs fine. The cause is probably a bug introduced during the porting to Python 3. The relevant piece of code in the write_results() method in trace.py is:
 if self.calledfuncs:
 print()
 print("functions called:")
 for filename, modulename, funcname in sorted(calls.keys()):
 print(("filename: %s, modulename: %s, funcname: %s"
 % (filename, modulename, funcname)))
The 'calls' variable in the loop isn't defined anywhere. Previously (in 2.6) this same chunk of code looked like this:
 if self.calledfuncs:
 print
 print "functions called:"
 calls = self.calledfuncs.keys()
 calls.sort()
 for filename, modulename, funcname in calls:
 print ("filename: %s, modulename: %s, funcname: %s"
 % (filename, modulename, funcname))
Which aliases 'calls' to 'self.calledfuncs.keys()'
------
Once this is confirmed as a bug, I will be happy to submit a patch that solves the problem.
History
Date User Action Args
2010年07月17日 08:38:41eli.benderskysetrecipients: + eli.bendersky, terry.reedy
2010年07月17日 08:38:40eli.benderskysetmessageid: <1279355920.89.0.901837761289.issue9282@psf.upfronthosting.co.za>
2010年07月17日 08:38:39eli.benderskylinkissue9282 messages
2010年07月17日 08:38:37eli.benderskycreate

AltStyle によって変換されたページ (->オリジナル) /