[Python-checkins] cpython: Issue #18520: Fix initstdio(), handle PySys_SetObject() failure
victor.stinner
python-checkins at python.org
Mon Jul 22 23:59:16 CEST 2013
http://hg.python.org/cpython/rev/a4998e8fd7fc
changeset: 84800:a4998e8fd7fc
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Jul 22 23:55:19 2013 +0200
summary:
Issue #18520: Fix initstdio(), handle PySys_SetObject() failure
files:
Python/pythonrun.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1159,8 +1159,14 @@
}
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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list