Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 63130:7b5d1527c0ce 2.6
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)
........
................
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Wed, 21 Jul 2010 16:50:52 +0000 |
| parents | e38335d4df91 |
| children | 787b969d37f0 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Wed Jul 21 01:40:15 2010 +0000 +++ b/Modules/arraymodule.c Wed Jul 21 16:50:52 2010 +0000 @@ -1262,8 +1262,14 @@ 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; } }
