summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-12-29 17:56:58 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-12-29 17:56:58 (GMT)
commit7af65568ffd047de653ec9a87e4217bbfdc9d43c (patch)
tree5bbdd1595bd874046be2637b9a49bd0b80e644a3 /Modules
parentfe231b07e41e8cfba8fb79e8440580c37e85183e (diff)
downloadcpython-7af65568ffd047de653ec9a87e4217bbfdc9d43c.zip
cpython-7af65568ffd047de653ec9a87e4217bbfdc9d43c.tar.gz
cpython-7af65568ffd047de653ec9a87e4217bbfdc9d43c.tar.bz2
#4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_fileio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 65cc99d..ca12822 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -98,7 +98,7 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kews)
directories, so we need a check. */
static int
-dircheck(PyFileIOObject* self)
+dircheck(PyFileIOObject* self, char *name)
{
#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
struct stat buf;
@@ -109,8 +109,8 @@ dircheck(PyFileIOObject* self)
PyObject *exc;
internal_close(self);
- exc = PyObject_CallFunction(PyExc_IOError, "(is)",
- EISDIR, msg);
+ exc = PyObject_CallFunction(PyExc_IOError, "(iss)",
+ EISDIR, msg, name);
PyErr_SetObject(PyExc_IOError, exc);
Py_XDECREF(exc);
return -1;
@@ -271,7 +271,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
#endif
goto error;
}
- if(dircheck(self) < 0)
+ if(dircheck(self, name) < 0)
goto error;
}