Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored and Fidget-Spinner committed Mar 27, 2023
1 parent ba86d35 commit 2cfaac1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2547,6 +2547,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
if (ferr == NULL || ferr == Py_None) {
/* sys.stderr is not set yet or set to None,
no need to try to display the exception */
Py_DECREF(exc);
return 0;
}

Expand All @@ -2555,7 +2556,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
PyObject *tb = PyException_GetTraceback(exc);
int has_tb = (tb != NULL) && (tb != Py_None);
Py_XDECREF(tb);
Py_XDECREF(exc);
Py_DECREF(exc);

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

0 comments on commit 2cfaac1

Please sign in to comment.