diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-29 03:01:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 03:01:43 +0200 |
commit | 4386b9045e5fe1151e65c2816264b5710000eb9f (patch) | |
tree | c1bcaffac32a12c8e8f52c1e621d18665b06ac6b /Python/pystate.c | |
parent | 37af21b667a9f41437b5b8e451497d7725016df5 (diff) | |
download | cpython-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 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index d6f58822b6..dd95750027 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; } |