comparison Python/sysmodule.c @ 62190:7ccc55811413 3.1

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. ........
author Victor Stinner <victor.stinner@haypocalc.com>
date Tue, 08 Jun 2010 20:50:09 +0000
parents 9db8c414921f
children f57c94073b35 3c9232a684ae
comparison
equal deleted inserted replaced
62187:9f7b8b32b074 62190:7ccc55811413
1668 sys_pyfile_write(const char *text, PyObject *file) 1668 sys_pyfile_write(const char *text, PyObject *file)
1669 { 1669 {
1670 PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL; 1670 PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL;
1671 int err; 1671 int err;
1672 1672
1673 if (file == NULL)
1674 return -1;
1675
1673 unicode = PyUnicode_FromString(text); 1676 unicode = PyUnicode_FromString(text);
1674 if (unicode == NULL) 1677 if (unicode == NULL)
1675 goto error; 1678 goto error;
1676 1679
1677 writer = PyObject_GetAttrString(file, "write"); 1680 writer = PyObject_GetAttrString(file, "write");