This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xiang.zhang
Recipients xiang.zhang
Date 2017-04-14.06:45:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492152323.97.0.555088221985.issue30068@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2017-04-14 06:45:24xiang.zhangsetrecipients: + xiang.zhang
2017-04-14 06:45:23xiang.zhangsetmessageid: <1492152323.97.0.555088221985.issue30068@psf.upfronthosting.co.za>
2017-04-14 06:45:23xiang.zhanglinkissue30068 messages
2017-04-14 06:45:22xiang.zhangcreate