Skip to content

bpo-40826: PyOS_InterruptOccurred() requires GIL #20578

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

Merged
merged 1 commit into from
Jun 1, 2020
Merged

bpo-40826: PyOS_InterruptOccurred() requires GIL #20578

merged 1 commit into from
Jun 1, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 1, 2020

PyOS_InterruptOccurred() now fails with a fatal error if it is called
with the GIL released.

https://bugs.python.org/issue40826

PyOS_InterruptOccurred() now fails with a fatal error if it is called
with the GIL released.
@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2020

This change doesn't fix https://bugs.python.org/issue40826 but change how the error is reported:

$ ./python
Python 3.10.0a0 (heads/pyos_interrupt:50c03b6d5c, Jun  1 2020, 20:33:02) 
>>> import os; os.close(0)
>>> Fatal Python error: PyOS_InterruptOccurred: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)
Python runtime state: initialized

Current thread 0x00007fb5791d4740 (most recent call first):
<no Python frame>
Abandon (core dumped)

@vstinner vstinner merged commit cbe1296 into python:master Jun 1, 2020
@vstinner vstinner deleted the pyos_interrupt branch June 1, 2020 18:34
vstinner added a commit that referenced this pull request Jun 3, 2020
…-20618)

* bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571)

Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if
tstate is NULL, the error message contains the current function name.

(cherry picked from commit 3026cad)

* bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578)

PyOS_InterruptOccurred() now fails with a fatal error if it is called
with the GIL released.

(cherry picked from commit cbe1296)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants