mirror of
https://github.com/python/cpython.git
synced 2025-11-17 01:25:57 +00:00
Fixed bug in _fileio.c and test_pep277. On Windows IOError.filename was not set because the name is stored in widename.
This commit is contained in:
parent
6ae5d7f2a1
commit
0b48954cd8
1 changed files with 4 additions and 0 deletions
|
|
@ -267,7 +267,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
|
||||||
self->fd = open(name, flags, 0666);
|
self->fd = open(name, flags, 0666);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (self->fd < 0 || dircheck(self) < 0) {
|
if (self->fd < 0 || dircheck(self) < 0) {
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
|
||||||
|
#else
|
||||||
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
|
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
|
||||||
|
#endif
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue