Commit 52ddc0e7 authored by Barry Warsaw's avatar Barry Warsaw

PyFile_FromString(): If an exception occurs, pass in the filename that

was used so it's reflected in the IOError.  Call
PyErr_SetFromErrnoWithFilename().
parent 97d95153
......@@ -137,13 +137,14 @@ PyFile_FromString(name, mode)
}
if (f->f_fp == NULL) {
#ifdef NO_FOPEN_ERRNO
/* Metroworks only, not testable, so unchanged */
if ( errno == 0 ) {
PyErr_SetString(PyExc_IOError, "Cannot open file");
Py_DECREF(f);
return NULL;
}
#endif
PyErr_SetFromErrno(PyExc_IOError);
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
Py_DECREF(f);
return NULL;
}
......
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