New submission from Eduardo Aguiar <agu...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to