summaryrefslogtreecommitdiffstats
path: root/Modules/_fileio.c
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-01-01 16:03:45 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-01-01 16:03:45 (GMT)
commit0f22d69cf6cb5e1bcf7aab4a81836c466a88ec86 (patch)
treeacc9f24c5582801ba63f5b56abe0a00aad7d9b3b /Modules/_fileio.c
parent646d9a20b99c4c285ea09064cb151e5e2f24c86c (diff)
downloadcpython-0f22d69cf6cb5e1bcf7aab4a81836c466a88ec86.zip
cpython-0f22d69cf6cb5e1bcf7aab4a81836c466a88ec86.tar.gz
cpython-0f22d69cf6cb5e1bcf7aab4a81836c466a88ec86.tar.bz2
Merged revisions 68134 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68134 | hirokazu.yamamoto | 2009-01-02 00:45:39 +0900 | 2 lines Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open file with `str' filename on Windows. ........
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r--Modules/_fileio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index c36a5de..8579e4e 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -284,10 +284,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
Py_END_ALLOW_THREADS
if (self->fd < 0) {
#ifdef MS_WINDOWS
- PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
-#else
- PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
+ if (widename != NULL)
+ PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
+ else
#endif
+ PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
goto error;
}
if(dircheck(self, name) < 0)