Mercurial > cpython-lru_cache-weakref
diff 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 |
line wrap: on
line diff
--- a/Python/sysmodule.c Tue Jun 08 17:15:33 2010 +0000 +++ b/Python/sysmodule.c Tue Jun 08 20:50:09 2010 +0000 @@ -1670,6 +1670,9 @@ 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;
