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.

classification
Title: profile does not dump stats on exception like cProfile does
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: c/profile refactoring
View: 17197
Assigned To: Nosy List: Jim.Jewett, anacrolix, arigo, georg.brandl, giampaolo.rodola, mwh
Priority: normal Keywords: needs review, patch

Created on 2011年08月03日 01:43 by anacrolix, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
exception-in-profile.patch anacrolix, 2011年08月03日 01:43
profiler-unhandled-exceptions.patch anacrolix, 2012年03月20日 14:27 review
Messages (8)
msg141591 - (view) Author: Matt Joiner (anacrolix) Date: 2011年08月03日 01:43
Here's a patch that fixes it.
msg146824 - (view) Author: Matt Joiner (anacrolix) Date: 2011年11月02日 04:06
Also affects 3.3.
msg155778 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012年03月14日 18:18
If I read that patch right, it ignores (and does not even reraise) SystemExit (unchanged), but other Exceptions currently block the dump (and your patch causes them to still dump). 
(1) Why is SystemExit ignored?
(2) There should be tests to show that there was a dump after, say, a MyError.
(3) You can use a single try ... except ... finally statement instead of two try statements.
msg155904 - (view) Author: Matt Joiner (anacrolix) Date: 2012年03月15日 16:28
Jim the code was lifted verbatim from Lib/cProfile.py, line 47.
That code in cProfile.py has not changed since 2006 when it was committed by Armin Rigo.
I can modernize it if it's a requirement to get it committed, but I'm also okay with my conservative patch as is.
msg156188 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012年03月17日 18:22
The same fix should be applied to runctx() too.
The SystemExit handling is fine, it's in the original code also.
I would recommend making a single try-except-finally statement.
msg156221 - (view) Author: Matt Joiner (anacrolix) Date: 2012年03月18日 01:08
I will submit a patch for this soon.
msg156415 - (view) Author: Matt Joiner (anacrolix) Date: 2012年03月20日 14:43
I attached a minimal patch that additionally tidies the exception handling for {cP,p}rofile.runctx.
msg184154 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013年03月14日 09:56
I wasn't aware of this issue (sorry) and I have already fixed this back in cset 422169310b7c for the 3.4 branch.
2.7, 3.2 and 3.3 branches can still be fixed though.
History
Date User Action Args
2022年04月11日 14:57:20adminsetgithub: 56893
2020年11月18日 19:17:46iritkatrielsetstatus: open -> closed
superseder: c/profile refactoring
resolution: duplicate
stage: patch review -> resolved
2013年03月14日 09:56:21giampaolo.rodolasetmessages: + msg184154
versions: + Python 2.7, - Python 3.4
2013年03月13日 20:50:21ezio.melottisetnosy: + giampaolo.rodola

versions: + Python 3.4
2012年03月20日 14:43:51anacrolixsetmessages: + msg156415
2012年03月20日 14:27:30anacrolixsetfiles: + profiler-unhandled-exceptions.patch
2012年03月18日 01:08:05anacrolixsetmessages: + msg156221
2012年03月17日 18:22:29georg.brandlsetmessages: + msg156188
2012年03月15日 16:28:39anacrolixsetnosy: + mwh, arigo
messages: + msg155904
2012年03月14日 18:18:24Jim.Jewettsetnosy: + Jim.Jewett
messages: + msg155778
2012年03月14日 16:46:42eric.araujosetkeywords: + needs review
nosy: + georg.brandl
stage: patch review

versions: - Python 3.4
2012年01月23日 03:42:41anacrolixsetstatus: languishing -> open
resolution: works for me -> (no value)
versions: + Python 3.4
2011年11月02日 04:06:22anacrolixsetmessages: + msg146824
versions: + Python 3.3
2011年11月02日 04:05:18anacrolixsetstatus: open -> languishing
resolution: works for me
2011年08月03日 01:43:17anacrolixcreate

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