[New-bugs-announce] [issue5395] array.fromfile not checking I/O errors
Eduardo Aguiar
report at bugs.python.org
Sat Feb 28 19:30:24 CET 2009
New submission from Eduardo Aguiar <aguiar at users.sourceforge.net>:
At arraymodule.c (line 1258):
nread = fread(item + (Py_SIZE(self) - n) * itemsize,
itemsize, n, fp);
if (nread < (size_t)n) {
Py_SIZE(self) -= (n - nread);
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");
return NULL;
}
When fread returns 0, ferror should be called to check if it was an EOF
or an error condition. It is not handling OSErrors, such as I/O errors,
raising always "not enough items in file".
----------
components: Library (Lib)
messages: 82936
nosy: aguiar
severity: normal
status: open
title: array.fromfile not checking I/O errors
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5395>
_______________________________________
More information about the New-bugs-announce
mailing list