summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-08 20:50:09 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-08 20:50:09 +0000
commit4ad65b48d1a0bbe271ad14045a3d4311d33f76b1 (patch)
tree59bdfa2a8bf070067619f70ac202fe69b6864818 /Python
parentdf5d1f3c33c946a1e849f18a48b90d768866ebbf (diff)
downloadcpython-4ad65b48d1a0bbe271ad14045a3d4311d33f76b1.tar.gz
Merged revisions 81841 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81841 | victor.stinner | 2010-06-08 22:46:00 +0200 (mar., 08 juin 2010) | 6 lines sys_pyfile_write() does nothing if file is NULL mywrite() falls back to the C file object if sys_pyfile_write() returns an error. This patch fixes a segfault is Py_FatalError() is called in an early stage of Python initialization. ........
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index ea67710423..e33047308d 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1670,6 +1670,9 @@ sys_pyfile_write(const char *text, PyObject *file)
PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL;
int err;
+ if (file == NULL)
+ return -1;
+
unicode = PyUnicode_FromString(text);
if (unicode == NULL)
goto error;