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 pablogsal
Recipients Melebius, chrahunt, glyph, gwk, kakshay, pablogsal, r.david.murray, torsten
Date 2019-01-24.09:06:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548320773.14.0.787221132169.issue27035@roundup.psfhosted.org>
In-reply-to
Content
You can always set the exit code calling sys.exit from outside the atexit handlers. I concur with R. David Murray in that calling sys.exit and expect anything sounds like a bad idea and an abuse if the atexit system.

A normal application would call sys.exit, some cleanup code will be called in the atexit handlers and finally the program will exit with the code originally set in the first call.

How and when your application will be calling sys.exit is an application architecture problem, and IMHO it should not be a CPython provided functionality to guarantee that you can do this in the atexit handlers.

It also violates the contract that right now is in the documentation: SystemExit exceptions are not printed or reraiaed in atexit handlers. Changing this (specially the second part) will be backwards incompatible, although that is a second order argument.
History
Date User Action Args
2019-01-24 09:06:14pablogsalsetrecipients: + pablogsal, glyph, r.david.murray, torsten, gwk, Melebius, chrahunt, kakshay
2019-01-24 09:06:13pablogsalsetmessageid: <1548320773.14.0.787221132169.issue27035@roundup.psfhosted.org>
2019-01-24 09:06:13pablogsallinkissue27035 messages
2019-01-24 09:06:12pablogsalcreate