diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 21:55:19 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 21:55:19 (GMT) |
| commit | ba30883f60271be3b4b8c14735566c943a83c68f (patch) | |
| tree | b7d1564d9607a5327664d6db3001c410905de4dc /Python | |
| parent | 5b3b1006bbb25902a6981b3447032d2b743be4c4 (diff) | |
| download | cpython-ba30883f60271be3b4b8c14735566c943a83c68f.zip cpython-ba30883f60271be3b4b8c14735566c943a83c68f.tar.gz cpython-ba30883f60271be3b4b8c14735566c943a83c68f.tar.bz2 | |
Issue #18520: Fix initstdio(), handle PySys_SetObject() failure
Diffstat (limited to 'Python')
| -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 |
