summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 118118ffe9..1f84215a13 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -1406,12 +1406,13 @@ _PyErr_WriteUnraisableMsg(const char *err_msg_str, PyObject *obj)
}
if (exc_tb == NULL) {
- PyFrameObject *frame = tstate->frame;
+ PyFrameObject *frame = PyThreadState_GetFrame(tstate);
if (frame != NULL) {
exc_tb = _PyTraceBack_FromFrame(NULL, frame);
if (exc_tb == NULL) {
_PyErr_Clear(tstate);
}
+ Py_DECREF(frame);
}
}