#4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms
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 @@
    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 @@
 		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 @@
 #endif
 			goto error;
 		}
-		if(dircheck(self) < 0)
+		if(dircheck(self, name) < 0)
 			goto error;
 	}