summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-01 18:34:15 (GMT)
committerGitHub <noreply@github.com>2020-06-01 18:34:15 (GMT)
commitcbe129692293251e7fbcea9ff0d822824d90c140 (patch)
tree36bb8545bcfc649f995812f89e65a9be3ebe9a95 /Modules/signalmodule.c
parent39de8e4b6f139f8d8284732bd7bb6e5ccced29fa (diff)
downloadcpython-cbe129692293251e7fbcea9ff0d822824d90c140.zip
cpython-cbe129692293251e7fbcea9ff0d822824d90c140.tar.gz
cpython-cbe129692293251e7fbcea9ff0d822824d90c140.tar.bz2
bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578)
PyOS_InterruptOccurred() now fails with a fatal error if it is called with the GIL released.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 8348971..6d340a6 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1782,8 +1782,9 @@ PyOS_FiniInterrupts(void)
int
PyOS_InterruptOccurred(void)
{
- PyInterpreterState *interp = _PyInterpreterState_GET();
- if (!_Py_ThreadCanHandleSignals(interp)) {
+ PyThreadState *tstate = _PyThreadState_GET();
+ _Py_EnsureTstateNotNULL(tstate);
+ if (!_Py_ThreadCanHandleSignals(tstate->interp)) {
return 0;
}