readline()/readlines() inconsistent?

Quinn Dunkan quinn at retch.ugcs.caltech.edu
Fri Jul 13 23:36:37 EDT 2001


On 9 Jul 2001 02:40:23 GMT, Quinn Dunkan <quinn at retch.ugcs.caltech.edu> wrote:
>Despite what the documentation may say, readlines does not use readline.
>readlines uses fread() (since it doesn't have to worry about reading too much)
>and then checks with ferror().  readline uses getc() (or perhaps fgets()) and,
>when it gets EOF for error, proceeds to *not* check for error (clears it, in
>fact).  So I'd say linux, SunOS, and Irix are correct here and OSX is wrong
>(must not be reporting via ferror() correctly).
>
>I'd say python is wrong here too, by not being consistent.  If readline
>checks, readlines should too.

I've submitted a patch that makes readline() check for errors.



More information about the Python-list mailing list