Message222140
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. |
|
Date |
User |
Action |
Args |
2014-07-02 22:38:34 | vstinner | set | recipients:
+ vstinner, pitrou, ivank, neologix, python-dev |
2014-07-02 22:38:33 | vstinner | set | messageid: <1404340713.99.0.241452930899.issue21090@psf.upfronthosting.co.za> |
2014-07-02 22:38:33 | vstinner | link | issue21090 messages |
2014-07-02 22:38:33 | vstinner | create | |
|