Skip to content

Commit 2cfaac1

Browse files
iritkatrielFidget-Spinner
authored andcommitted
1 parent ba86d35 commit 2cfaac1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/pylifecycle.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2547,6 +2547,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
25472547
if (ferr == NULL || ferr == Py_None) {
25482548
/* sys.stderr is not set yet or set to None,
25492549
no need to try to display the exception */
2550+
Py_DECREF(exc);
25502551
return 0;
25512552
}
25522553

@@ -2555,7 +2556,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
25552556
PyObject *tb = PyException_GetTraceback(exc);
25562557
int has_tb = (tb != NULL) && (tb != Py_None);
25572558
Py_XDECREF(tb);
2558-
Py_XDECREF(exc);
2559+
Py_DECREF(exc);
25592560

25602561
/* sys.stderr may be buffered: call sys.stderr.flush() */
25612562
PyObject *res = PyObject_CallMethodNoArgs(ferr, &_Py_ID(flush));

0 commit comments

Comments
 (0)