diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-29 01:01:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 01:01:43 (GMT) |
commit | 4386b9045e5fe1151e65c2816264b5710000eb9f (patch) | |
tree | c1bcaffac32a12c8e8f52c1e621d18665b06ac6b /Python | |
parent | 37af21b667a9f41437b5b8e451497d7725016df5 (diff) | |
download | cpython-4386b9045e5fe1151e65c2816264b5710000eb9f.zip cpython-4386b9045e5fe1151e65c2816264b5710000eb9f.tar.gz cpython-4386b9045e5fe1151e65c2816264b5710000eb9f.tar.bz2 |
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 'Python')
-rw-r--r-- | Python/errors.c | 2 | ||||
-rw-r--r-- | Python/pystate.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Python/errors.c b/Python/errors.c index db00770..9e53d05 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -1372,7 +1372,7 @@ _PyErr_WriteUnraisableMsg(const char *err_msg_str, PyObject *obj) } if (exc_tb == NULL) { - struct _frame *frame = tstate->frame; + PyFrameObject *frame = tstate->frame; if (frame != NULL) { exc_tb = _PyTraceBack_FromFrame(NULL, frame); if (exc_tb == NULL) { diff --git a/Python/pystate.c b/Python/pystate.c index d6f5882..dd95750 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1042,11 +1042,13 @@ PyThreadState_GetInterpreter(PyThreadState *tstate) } -struct _frame* +PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate) { assert(tstate != NULL); - return tstate->frame; + PyFrameObject *frame = tstate->frame; + Py_XINCREF(frame); + return frame; } @@ -1165,7 +1167,7 @@ _PyThread_CurrentFrames(void) for (i = runtime->interpreters.head; i != NULL; i = i->next) { PyThreadState *t; for (t = i->tstate_head; t != NULL; t = t->next) { - struct _frame *frame = t->frame; + PyFrameObject *frame = t->frame; if (frame == NULL) { continue; } |