diff options
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 30e5e6f..18c2baa 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -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 |