Skip to content

Commit 63892dc

Browse files
committed
Fix potential double-decref.
1 parent e96740b commit 63892dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/errors.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,10 +1499,11 @@ write_unraisable_exc_file(PyThreadState *tstate, PyObject *exc_type,
14991499
// Nothing else to do
15001500
return 0;
15011501
}
1502+
} else {
1503+
Py_XDECREF(print_exception_fn);
15021504
}
15031505
// traceback module failed, fall back to pure C
15041506
_PyErr_Clear(tstate);
1505-
Py_XDECREF(print_exception_fn);
15061507

15071508
if (exc_tb != NULL && exc_tb != Py_None) {
15081509
if (PyTraceBack_Print(exc_tb, file) < 0) {

0 commit comments

Comments
 (0)