diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-21 16:50:52 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-07-21 16:50:52 (GMT) |
commit | ea435512eaa8dd3f2a1e1c30e874486d2073038c (patch) | |
tree | ded7065b93aece873a0150dbbb226221da1fc712 /Modules | |
parent | f247101a4c4370af880a7faa08dad13872a6ba6c (diff) | |
download | cpython-ea435512eaa8dd3f2a1e1c30e874486d2073038c.zip cpython-ea435512eaa8dd3f2a1e1c30e874486d2073038c.tar.gz cpython-ea435512eaa8dd3f2a1e1c30e874486d2073038c.tar.bz2 |
Merged revisions 83031 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
................
r83031 | antoine.pitrou | 2010-07-21 18:47:28 +0200 (mer., 21 juil. 2010) | 11 lines
Merged revisions 83030 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83030 | antoine.pitrou | 2010-07-21 18:41:31 +0200 (mer., 21 juil. 2010) | 5 lines
Issue #5395: check that array.fromfile() re-raises an IOError instead of replacing it
with EOFError.
(this is only an added test, but 2.x will get a fix too)
........
................
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/arraymodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index b571fe8..da1bb02 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1262,8 +1262,14 @@ array_fromfile(arrayobject *self, PyObject *args) PyMem_RESIZE(item, char, Py_SIZE(self)*itemsize); self->ob_item = item; self->allocated = Py_SIZE(self); - PyErr_SetString(PyExc_EOFError, - "not enough items in file"); + if (ferror(fp)) { + PyErr_SetFromErrno(PyExc_IOError); + clearerr(fp); + } + else { + PyErr_SetString(PyExc_EOFError, + "not enough items in file"); + } return NULL; } } |