Issue #18520: Fix initstdio(), handle PySys_SetObject() failure
This commit is contained in:
parent
5b3b1006bb
commit
ba30883f60
|
@ -1159,8 +1159,14 @@ initstdio(void)
|
|||
}
|
||||
PyErr_Clear(); /* Not a fatal error if codec isn't available */
|
||||
|
||||
PySys_SetObject("__stderr__", std);
|
||||
PySys_SetObject("stderr", std);
|
||||
if (PySys_SetObject("__stderr__", std) < 0) {
|
||||
Py_DECREF(std);
|
||||
goto error;
|
||||
}
|
||||
if (PySys_SetObject("stderr", std) < 0) {
|
||||
Py_DECREF(std);
|
||||
goto error;
|
||||
}
|
||||
Py_DECREF(std);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue