[issue27035] Cannot set exit code in atexit callback

Mike Hommey report at bugs.python.org
Thu Aug 19 05:07:24 EDT 2021


Mike Hommey <glandium at gmail.com> added the comment:

> I think we should change the documentation to expand the parenthetical " (unless SystemExit is raised)" to a complete explanation of that special case.

That would not be enough, since the case for other exceptions would still be ambiguous, as the described behavior ("After all exit handlers have had a chance to run the last exception to be raised is re-raised.") would imply the exit code would be altered, like when exceptions are raised in normal context. In 2.7 the only exception that _did_ change the exit code was SystemExit.

----------
nosy: +Mike Hommey

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27035>
_______________________________________


More information about the Python-bugs-list mailing list