Commit 99a1b20b authored by Hirokazu Yamamoto's avatar Hirokazu Yamamoto

Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open

file with `str' filename on Windows.
parent 733dc744
...@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1 ...@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
file with `str' filename on Windows.
- Issue #3680: Reference cycles created through a dict, set or deque iterator - Issue #3680: Reference cycles created through a dict, set or deque iterator
did not get collected. did not get collected.
......
...@@ -265,10 +265,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) ...@@ -265,10 +265,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (self->fd < 0) { if (self->fd < 0) {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
if (widename != NULL)
PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename); PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
#else else
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
#endif #endif
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
goto error; goto error;
} }
if(dircheck(self, name) < 0) if(dircheck(self, name) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment