mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#4764 set IOError.filename when trying to open a directory on POSIX platforms
This commit is contained in:
parent
732479f50b
commit
fe231b07e4
3 changed files with 18 additions and 2 deletions
|
@ -132,8 +132,8 @@ dircheck(PyFileObject* f)
|
|||
if (fstat(fileno(f->f_fp), &buf) == 0 &&
|
||||
S_ISDIR(buf.st_mode)) {
|
||||
char *msg = strerror(EISDIR);
|
||||
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)",
|
||||
EISDIR, msg);
|
||||
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(isO)",
|
||||
EISDIR, msg, f->f_name);
|
||||
PyErr_SetObject(PyExc_IOError, exc);
|
||||
Py_XDECREF(exc);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue