[Python-Dev] Re: _PyTuple_Resize() in 2.2

Neil Schemenauer nas@python.ca
Thu, 29 Nov 2001 15:05:10 -0800


Gustavo Niemeyer wrote:
> Python 2.1 (#1, Jun 22 2001, 17:13:13) 
> [GCC 2.95.3 20010315 (release) (conectiva)] on linux-i386
> Type "copyright", "credits" or "license" for more information.
> >>> open("/etc").readline()
> ''

I'm pretty sure patch 2.117 to fileobject.c caused this change in
behavior.  Here is the log message:

    date: 2001/08/09 18:14:59;  author: gvanrossum;  state: Exp;  lines: +6 -0
    Apply anonymous SF patch #441229.

      Previously, f.read() and f.readlines() checked for
      errors on their file object and possibly raised an
      IOError, but f.readline() didn't. This patch makes
      f.readline() behave like the others.

    Note that I've added a call to clearerr() since the other calls to
    ferror() include that too.

    I have no way to test this code. :-)

Try open("/etc").read() with 2.1.  I get an IOError exception.

  Neil