Commit ba30883f authored by Victor Stinner's avatar Victor Stinner

Issue #18520: Fix initstdio(), handle PySys_SetObject() failure

parent 5b3b1006
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment