This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ivank, neologix, pitrou, python-dev, vstinner
Date 2014-07-02.22:38:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404340713.99.0.241452930899.issue21090@psf.upfronthosting.co.za>
In-reply-to
Content
For Python 2, file.read() looks wrong: if only checks ferror() if fread() returns 0, whereas Py_UniversalNewlineFread() can call fread() more than once, and according to fread() manual page, fread() result can be different than 0 on error.

"If an error occurs, or the end of the file is reached, the return value is a short item count (or zero)."
http://linux.die.net/man/3/fread

Attached fileobject.c rewrites error handling in fileobject.c. The main change if that ferror() is called even if fread() does not return 0.
History
Date User Action Args
2014-07-02 22:38:34vstinnersetrecipients: + vstinner, pitrou, ivank, neologix, python-dev
2014-07-02 22:38:33vstinnersetmessageid: <1404340713.99.0.241452930899.issue21090@psf.upfronthosting.co.za>
2014-07-02 22:38:33vstinnerlinkissue21090 messages
2014-07-02 22:38:33vstinnercreate