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.

classification
Title: gprof2html is broken
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, eric.araujo, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2012-04-05 13:01 by Claudiu.Popa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
gprof.patch Claudiu.Popa, 2012-04-05 13:01
gprof.patch Claudiu.Popa, 2012-04-06 08:10 review
Messages (6)
msg157580 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2012-04-05 13:01
Tools/gprof2html.py uses "file" to open a file. Also, the opened file passed to add_escapes was never closed. There's a test included in the patch.
msg157631 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-06 01:25
I'm getting 'malformed patch at line 30' when I try to apply your patch.

Also, while it's not wrong, I don't think there's much point in catching the NameError and doing a fail.  The second Exception clause is definitely wrong, though, we don't want other errors to pass silently.   So I think the test should just do the call to gprof.main, with a comment mentioning this bug and saying that the call used to raise a NameError. (If it does fail for some other reason, then the test will need to get a little more complicated so that it doesn't.)
msg157646 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-06 06:21
Should also use with statements IMO.
msg157651 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2012-04-06 08:10
Hello. I've attached the new version of the patch. I used with statement in add_escapes and the test was rewritten according to David's suggestion.
msg158069 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-11 19:17
New changeset 4d603d6782db by R David Murray in branch '3.2':
#14508: make gprof2html script runnable under python3
http://hg.python.org/cpython/rev/4d603d6782db

New changeset 73fba223c0a5 by R David Murray in branch 'default':
#14508: make gprof2html script runnable under python3
http://hg.python.org/cpython/rev/73fba223c0a5
msg158070 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-11 19:20
Thanks for the patch.  I don't think you ran the test though, since it didn't pass, and there was a mistake in your patch :)

I had to change the test considerably, and only applied the test part on 3.3 since I used mock.
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58713
2012-04-11 19:20:58r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg158070

stage: resolved
2012-04-11 19:17:51python-devsetnosy: + python-dev
messages: + msg158069
2012-04-06 08:10:46Claudiu.Popasetfiles: + gprof.patch

messages: + msg157651
2012-04-06 06:21:26eric.araujosetnosy: + eric.araujo
messages: + msg157646
2012-04-06 01:25:42r.david.murraysetnosy: + r.david.murray
messages: + msg157631
2012-04-05 13:01:07Claudiu.Popacreate