Message222140
| 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: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 |
|