Skip to content

Commit 234328d

Browse files
Fix refcounts.
1 parent cf87452 commit 234328d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/crossinterp_exceptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ _ensure_current_cause(PyThreadState *tstate, PyObject *cause)
99
assert(exc != NULL);
1010
PyObject *ctx = PyException_GetContext(exc);
1111
if (ctx == NULL) {
12-
PyException_SetContext(exc, cause);
12+
PyException_SetContext(exc, Py_NewRef(cause));
1313
}
1414
else {
1515
Py_DECREF(ctx);
1616
}
1717
assert(PyException_GetCause(exc) == NULL);
18-
PyException_SetCause(exc, cause);
18+
PyException_SetCause(exc, Py_NewRef(cause));
1919
_PyErr_SetRaisedException(tstate, exc);
2020
}
2121

0 commit comments

Comments
 (0)