summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-09-01 14:13:43 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-09-01 14:13:43 (GMT)
commitf22c26ecf4c28e16d262cdb1305411286fb925c9 (patch)
tree2f02372674b38da2f4915e5a3e5a86b580bb3172 /Modules
parentf07e5a9e4b5418829e0b2e907ae5e9b7bb8f90c8 (diff)
downloadcpython-f22c26ecf4c28e16d262cdb1305411286fb925c9.zip
cpython-f22c26ecf4c28e16d262cdb1305411286fb925c9.tar.gz
cpython-f22c26ecf4c28e16d262cdb1305411286fb925c9.tar.bz2
#3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_fileio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index d6f004f..c3d61b4 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -262,7 +262,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
#endif
self->fd = open(name, flags, 0666);
Py_END_ALLOW_THREADS
- if (self->fd < 0 || dircheck(self) < 0) {
+ if (self->fd < 0) {
#ifdef MS_WINDOWS
PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
#else
@@ -270,6 +270,8 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
#endif
goto error;
}
+ if(dircheck(self) < 0)
+ goto error;
}
goto done;