Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-1054041: Re-init _Py_UnhandledKeyboardInterrupt before run. #11963

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Feb 21, 2019

Explicitly reinitialize this every eval just in case someone is
calling into an embedded Python where they don't care about an uncaught
KeyboardInterrupt exception (why didn't they leave
config.install_signal_handlers set to 0?!?) but then later call
Py_Main() itself (which checks this flag and dies with a signal after
its interpreter exits). We don't want a previous embedded interpreter's
uncaught exception to trigger an unexplained signal exit from a future
Py_Main() based one.

https://bugs.python.org/issue1054041

Explicitly reinitialize this every eval *just in case* someone is
calling into an embedded Python where they don't care about an uncaught
KeyboardInterrupt exception (why didn't they leave
`config.install_signal_handlers` set to `0`?!?) but then later call
`Py_Main()` itself (which *checks* this flag and dies with a signal after
its interpreter exits).  We don't want a previous embedded interpreter's
uncaught exception to trigger an unexplained signal exit from a future
`Py_Main()` based one.
@Yhg1s
Copy link
Member

Yhg1s commented Feb 21, 2019

FWIW, another reason to do this is so changes to what bits of code check for the _Py_UnhandledKeyboardInterrupt variable (e.g. if it was moved to Py_Finalize) don't cause unintended behaviour changes in embedded Python interpreters.

@gpshead gpshead merged commit d9bc543 into python:master Feb 21, 2019
@gpshead gpshead deleted the sigint_exit_odd_case_fixup branch February 21, 2019 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants