[issue1054041] Python doesn't exit with proper resultcode on SIGINT

Gregory P. Smith report at bugs.python.org
Sat Feb 16 16:08:03 EST 2019


Gregory P. Smith <greg at krypto.org> added the comment:

This is in for 3.8.

On earlier or unpatched Python versions: application owners have a workaround f they do not mind skipping a clean application shutdown (destructors) on posix platforms:
catch KeyboardInterrupt, reset SIGINT to SIG_DFL, kill(getpid(), SIGINT).  If you somehow need the python destructor cleanup (never guaranteed, so unwise to _depend_ on it) you could do that in a C atexit handler.

On Windows the workaround is easier without altering clean shutdown, catch KeyboardInterrupt and sys.exit(0xC000013A - 2**32).

----------
assignee:  -> gregory.p.smith
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

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


More information about the Python-bugs-list mailing list