[New-bugs-announce] [issue30068] missing iter(self) in _io._IOBase.readlines
Xiang Zhang
report at bugs.python.org
Fri Apr 14 02:45:23 EDT 2017
New submission from Xiang Zhang:
In _io._IOBase.readlines, it straightly uses PyIter_Next(self). But iter(_io._IOBase) does more work than just returning itself.
>>> import _io
>>> f = _io._IOBase()
>>> f.close()
>>> f.readlines()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file.
>>> f.readlines(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: '_io._IOBase' object has no attribute 'read'
----------
components: IO
messages: 291641
nosy: xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: missing iter(self) in _io._IOBase.readlines
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30068>
_______________________________________
More information about the New-bugs-announce
mailing list