summaryrefslogtreecommitdiffstats
path: root/Modules/_fileio.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-10-31 19:20:48 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-10-31 19:20:48 (GMT)
commit0b48954cd856e0391acefb6355a4ab98e5f7b3c0 (patch)
tree7b319d76842c39d422c1f7fc0055e46b4f834b30 /Modules/_fileio.c
parent6ae5d7f2a132aa9690bfb59b8eebcc1fb7c792c8 (diff)
downloadcpython-0b48954cd856e0391acefb6355a4ab98e5f7b3c0.zip
cpython-0b48954cd856e0391acefb6355a4ab98e5f7b3c0.tar.gz
cpython-0b48954cd856e0391acefb6355a4ab98e5f7b3c0.tar.bz2
Fixed bug in _fileio.c and test_pep277. On Windows IOError.filename was not set because the name is stored in widename.
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r--Modules/_fileio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 8469bb2..f02c5ef 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -267,7 +267,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
self->fd = open(name, flags, 0666);
Py_END_ALLOW_THREADS
if (self->fd < 0 || dircheck(self) < 0) {
+#ifdef MS_WINDOWS
+ PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
+#else
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
+#endif
goto error;
}
}