summaryrefslogtreecommitdiff
path: root/Modules/_xxsubinterpretersmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-29 03:01:43 +0200
committerGitHub <noreply@github.com>2020-04-29 03:01:43 +0200
commit4386b9045e5fe1151e65c2816264b5710000eb9f (patch)
treec1bcaffac32a12c8e8f52c1e621d18665b06ac6b /Modules/_xxsubinterpretersmodule.c
parent37af21b667a9f41437b5b8e451497d7725016df5 (diff)
downloadcpython-git-4386b9045e5fe1151e65c2816264b5710000eb9f.tar.gz
bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
The PyThreadState_GetFrame() function now returns a strong reference to the frame.
Diffstat (limited to 'Modules/_xxsubinterpretersmodule.c')
-rw-r--r--Modules/_xxsubinterpretersmodule.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index e618930e09..15e80559ec 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -1840,14 +1840,17 @@ _is_running(PyInterpreterState *interp)
"interpreter has more than one thread");
return -1;
}
+
+ assert(!PyErr_Occurred());
PyFrameObject *frame = PyThreadState_GetFrame(tstate);
if (frame == NULL) {
- if (PyErr_Occurred() != NULL) {
- return -1;
- }
return 0;
}
- return (int)(frame->f_executing);
+
+ int executing = (int)(frame->f_executing);
+ Py_DECREF(frame);
+
+ return executing;
}
static int