diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-12-13 01:01:38 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-12-13 01:01:38 (GMT) |
commit | fdeb6ec45ab898e2783e44495a756f56b42f4a80 (patch) | |
tree | 572112b73b25f09bea638391bd351375a7ceb9a0 /Python/sysmodule.c | |
parent | 62ca10051b5aa07b86807a50674dbef4cace22f7 (diff) | |
download | cpython-fdeb6ec45ab898e2783e44495a756f56b42f4a80.zip cpython-fdeb6ec45ab898e2783e44495a756f56b42f4a80.tar.gz cpython-fdeb6ec45ab898e2783e44495a756f56b42f4a80.tar.bz2 |
Issue #14432: Remove the thread state field from the frame structure. Fix a
crash when a generator is created in a C thread that is destroyed while the
generator is still used. The issue was that a generator contains a frame, and
the frame kept a reference to the Python state of the destroyed C thread. The
crash occurs when a trace function is setup.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 4028a01..961657e 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -367,7 +367,7 @@ trace_init(void) static PyObject * -call_trampoline(PyThreadState *tstate, PyObject* callback, +call_trampoline(PyObject* callback, PyFrameObject *frame, int what, PyObject *arg) { PyObject *args; @@ -405,12 +405,11 @@ static int profile_trampoline(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) { - PyThreadState *tstate = frame->f_tstate; PyObject *result; if (arg == NULL) arg = Py_None; - result = call_trampoline(tstate, self, frame, what, arg); + result = call_trampoline(self, frame, what, arg); if (result == NULL) { PyEval_SetProfile(NULL, NULL); return -1; @@ -423,7 +422,6 @@ static int trace_trampoline(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) { - PyThreadState *tstate = frame->f_tstate; PyObject *callback; PyObject *result; @@ -433,7 +431,7 @@ trace_trampoline(PyObject *self, PyFrameObject *frame, callback = frame->f_trace; if (callback == NULL) return 0; - result = call_trampoline(tstate, callback, frame, what, arg); + result = call_trampoline(callback, frame, what, arg); if (result == NULL) { PyEval_SetTrace(NULL, NULL); Py_XDECREF(frame->f_trace); |