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 <rep...@bugs.python.org>
<http://bugs.python.org/issue30068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to