[Python-checkins] r61468 - python/trunk/Objects/fileobject.c
gregory.p.smith
python-checkins at python.org
Tue Mar 18 01:20:02 CET 2008
Author: gregory.p.smith
Date: Tue Mar 18 01:20:01 2008
New Revision: 61468
Modified:
python/trunk/Objects/fileobject.c
Log:
Fix the IOError message text when opening a file with an invalid filename.
Error reported by Ilan Schnell.
Modified: python/trunk/Objects/fileobject.c
==============================================================================
--- python/trunk/Objects/fileobject.c (original)
+++ python/trunk/Objects/fileobject.c Tue Mar 18 01:20:01 2008
@@ -256,9 +256,12 @@
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;
More information about the Python-checkins
mailing list