mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-102755: fix refleak (#102826)
This commit is contained in:
parent
ad77b80b05
commit
ccb5af7bfe
1 changed files with 2 additions and 1 deletions
|
@ -2547,6 +2547,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
|
||||||
if (ferr == NULL || ferr == Py_None) {
|
if (ferr == NULL || ferr == Py_None) {
|
||||||
/* sys.stderr is not set yet or set to None,
|
/* sys.stderr is not set yet or set to None,
|
||||||
no need to try to display the exception */
|
no need to try to display the exception */
|
||||||
|
Py_DECREF(exc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2555,7 +2556,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
|
||||||
PyObject *tb = PyException_GetTraceback(exc);
|
PyObject *tb = PyException_GetTraceback(exc);
|
||||||
int has_tb = (tb != NULL) && (tb != Py_None);
|
int has_tb = (tb != NULL) && (tb != Py_None);
|
||||||
Py_XDECREF(tb);
|
Py_XDECREF(tb);
|
||||||
Py_XDECREF(exc);
|
Py_DECREF(exc);
|
||||||
|
|
||||||
/* sys.stderr may be buffered: call sys.stderr.flush() */
|
/* sys.stderr may be buffered: call sys.stderr.flush() */
|
||||||
PyObject *res = PyObject_CallMethodNoArgs(ferr, &_Py_ID(flush));
|
PyObject *res = PyObject_CallMethodNoArgs(ferr, &_Py_ID(flush));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue