Fixed bug in _fileio.c and test_pep277. On Windows IOError.filename was not set becau...
authorChristian Heimes <christian@cheimes.de>
Wed, 31 Oct 2007 19:20:48 +0000 (19:20 +0000)
committerChristian Heimes <christian@cheimes.de>
Wed, 31 Oct 2007 19:20:48 +0000 (19:20 +0000)
Modules/_fileio.c

index 8469bb248f27ac1fc4b6e4df94c69c915e78f4b8..f02c5ef16a2f9308c488eed0f3887b9e3327b51a 100644 (file)
@@ -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;
                }
        }