Issue1257
Created on 2007-10-10 19:56 by aminusfu, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| ghop-215-py2.6-ctb.diff | titus, 2008-01-08 10:47 | Working patch with doc+test against latest trunk. | review | |
| Messages (11) | |||
|---|---|---|---|
| msg56323 - (view) | Author: Robert Brewer (aminusfu) | Date: 2007-10-10 19:56 | |
While debugging/fixing the logging module's atexit behavior (see http://www.cherrypy.org/ticket/646 -- it chokes atexit if stdout is closed), it became difficult to write an automated test that verified the bug occurred, since it happened at program exit. Returning a nonzero exit code when atexit errors occur would be preferable to just printing the error. Of course, if SystemExit is already raised, we should propagate that out, but other exceptions should print the traceback and then return some other code IMO. |
|||
| msg56324 - (view) | Author: Lakin Wecker (lakin.wecker) | Date: 2007-10-10 20:03 | |
I am an agreeance with the original report. I just finished writing an automated test that did the following to work around this behavior: 46 # Sometimes an exception happens during exit, try to make sure we get 47 # a non_zero exit code. 48 old_exitfunc = sys.exitfunc 49 def exitfunc(): 50 try: 51 old_exitfunc() 52 except SystemExit: 53 raise 54 except: 55 raise SystemExit(1) |
|||
| msg56325 - (view) | Author: Lakin Wecker (lakin.wecker) | Date: 2007-10-10 20:04 | |
sorry for the noise and duplication. The full code listing should have been: 46 # Sometimes an exception happens during exit, try to make sure we get 47 # a non_zero exit code. 48 old_exitfunc = sys.exitfunc 49 def exitfunc(): 50 try: 51 old_exitfunc() 52 except SystemExit: 53 raise 54 except: 55 raise SystemExit(1) 56 sys.exitfunc = exitfunc |
|||
| msg57677 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2007-11-20 00:51 | |
The issue should be addressed in the C code. |
|||
| msg59529 - (view) | Author: Titus Brown (titus) | Date: 2008-01-08 10:47 | |
Please see GHOP patches by anders_v...@yahoo.se, http://code.google.com/p/google-highly-open-participation-psf/issues/detail?id=215 I've attached the Python 2.6 patch here. |
|||
| msg67043 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-05-18 21:18 | |
I'm assigning this to Christian because he was doing the GHOP review. |
|||
| msg116780 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2010-09-18 14:05 | |
Can someone please review the attached patch with a view to committing, it contains doc and unit test changes. |
|||
| msg117159 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * ![]() |
Date: 2010-09-22 23:20 | |
exit code = 128 + # of failed atexits I don't agree with the feature. Do we need something so complex? |
|||
| msg132590 - (view) | Author: ysj.ray (ysj.ray) | Date: 2011-03-30 13:57 | |
I think there is no need to implement this in python2.x since it's a behavior change which could introduce some compatibility issues to someone's code, besides in 2.x both sys.exitfunc and atexit module should be considered, that makes the code looks complex. The sys.exitfunc is removed in 3.x. +1 on only implementing it in 3.3. |
|||
| msg195587 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2013-08-18 23:16 | |
I would disagree with this report. There are many errors which are effectively silenced by Python, except for being printed on stderr: for example, errors which occur in a __del__ method or a weakref callback (both of which semantically similar to an atexit handler); but also exceptions which terminate a non-main thread. Python's error code is derived from the return status of the main thread of execution, not counting any kinds of asynchronous exceptions, which are simply displayed and then ignored. If you want to write a test for errors at program exit, you should check for stderr's contents (by capturing it). |
|||
| msg342549 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-05-15 03:11 | |
Antoine disagrees with the feature request, so I close it. You can modify your atexit callbacks to catch exceptions and decide how to handle them: write them into a file, into stderr, etc. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:27 | admin | set | github: 45598 |
| 2019-05-15 03:11:04 | vstinner | set | status: open -> closed nosy:
+ vstinner resolution: rejected |
| 2014-02-03 17:03:07 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2013-08-18 23:16:48 | pitrou | set | nosy:
+ pitrou messages: + msg195587 |
| 2013-08-18 22:37:47 | doughellmann | set | nosy:
+ doughellmann |
| 2013-06-24 17:09:01 | christian.heimes | set | assignee: christian.heimes -> versions: + Python 3.4, - Python 3.1, Python 2.7, Python 3.2, Python 3.3 |
| 2011-03-30 13:57:52 | ysj.ray | set | nosy:
+ ysj.ray messages:
+ msg132590 |
| 2010-09-22 23:20:59 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg117159 |
| 2010-09-18 14:05:06 | BreamoreBoy | set | versions:
- Python 2.6 nosy: + BreamoreBoy messages: + msg116780 stage: patch review |
| 2010-06-09 22:19:50 | terry.reedy | set | versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.5, Python 2.4, Python 3.0 |
| 2008-05-18 21:18:24 | benjamin.peterson | set | assignee: gvanrossum -> christian.heimes messages: + msg67043 nosy: + benjamin.peterson |
| 2008-01-08 10:47:08 | titus | set | files:
+ ghop-215-py2.6-ctb.diff nosy: + titus messages: + msg59529 |
| 2007-11-20 00:51:03 | christian.heimes | set | priority: normal assignee: gvanrossum messages: + msg57677 nosy: + christian.heimes, gvanrossum |
| 2007-10-10 20:04:47 | lakin.wecker | set | messages: + msg56325 |
| 2007-10-10 20:03:54 | lakin.wecker | set | nosy:
+ lakin.wecker messages: + msg56324 |
| 2007-10-10 19:56:26 | aminusfu | create | |
