[New-bugs-announce] [issue3521] file.readline: bad exception recovery

Terry J. Reedy report at bugs.python.org
Fri Aug 8 00:36:51 CEST 2008

New submission from Terry J. Reedy <tjreedy at udel.edu>:

WinXP, 3.0b2
>>>f=open('somefile', 'r')
Traceback (most recent call last):
  File "<pyshell#70>", line 1, in <module>
  File "C:\Program Files\Python30\lib\io.py", line 1766, in readline
    return line[:endpos]
TypeError: slice indices must be integers or None or have an __index__

At this point, any f.read or f.readline calls fail with a similar
TypeError.  The error recovery seems incomplete.  The same does *not*
happen with f.read(float).  Recovery is complete and subsequent
f.read/f.readline calls work.

In 2.5, float size arg worked with a deprecation warning, so issue does
not arise.  I presume same is true in 2.6.

components: Interpreter Core
messages: 70866
nosy: tjreedy
severity: normal
status: open
title: file.readline: bad exception recovery
type: behavior
versions: Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list