diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-03-18 00:20:01 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-03-18 00:20:01 (GMT) |
commit | 887290d275a68754aa15a9924640faab392754b6 (patch) | |
tree | 96be6a057c29a963fce2c9692da4c7580e4920d2 | |
parent | a7d57cd4336c72b9268ab1bc430ac15e28517797 (diff) | |
download | cpython-887290d275a68754aa15a9924640faab392754b6.zip cpython-887290d275a68754aa15a9924640faab392754b6.tar.gz cpython-887290d275a68754aa15a9924640faab392754b6.tar.bz2 |
Fix the IOError message text when opening a file with an invalid filename.
Error reported by Ilan Schnell.
-rw-r--r-- | Objects/fileobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 932b7dc..6f8eb7c 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -256,9 +256,12 @@ open_the_file(PyFileObject *f, char *name, char *mode) else if (errno == EINVAL) /* unknown, but not a mode string */ errno = ENOENT; #endif + /* EINVAL is returned when an invalid filename or + * an invalid mode is supplied. */ if (errno == EINVAL) - PyErr_Format(PyExc_IOError, "invalid mode: %s", - mode); + PyErr_Format(PyExc_IOError, + "invalid filename: %s or mode: %s", + name, mode); else PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, f->f_name); f = NULL; |