summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-01-01 15:45:39 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-01-01 15:45:39 (GMT)
commit99a1b20bbf906299a7ea7b871f290dee580a3f18 (patch)
treeccedad1c8bb2ad53f32b039bdf0a961f12bd79ff /Modules
parent733dc74442a89972278d1fdf8a64b5739cdbad67 (diff)
downloadcpython-99a1b20bbf906299a7ea7b871f290dee580a3f18.zip
cpython-99a1b20bbf906299a7ea7b871f290dee580a3f18.tar.gz
cpython-99a1b20bbf906299a7ea7b871f290dee580a3f18.tar.bz2
Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
file with `str' filename on Windows.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_fileio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index ca12822..2dc3d74 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -265,10 +265,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)