classification
Title: missing iter(self) in _io._IOBase.readlines
Type: behavior Stage: resolved
Components: IO Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, serhiy.storchaka, stutzbach, xiang.zhang
Priority: normal Keywords:

Created on 2017-04-14 06:45 by xiang.zhang, last changed 2017-04-15 05:28 by xiang.zhang. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1130 merged xiang.zhang, 2017-04-14 06:54
PR 1150 merged xiang.zhang, 2017-04-15 04:56
PR 1151 merged xiang.zhang, 2017-04-15 04:57
PR 1152 merged xiang.zhang, 2017-04-15 05:03
Messages (5)
msg291641 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-14 06:45
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'
msg291699 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-15 04:47
New changeset 026435ce49419a3366171416c68114dd8a1144c7 by Xiang Zhang in branch 'master':
bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130)
https://github.com/python/cpython/commit/026435ce49419a3366171416c68114dd8a1144c7
msg291701 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-15 05:18
New changeset 5fbdfc36f397ad46f4057d527855dfacb77242ce by Xiang Zhang in branch '2.7':
bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1152)
https://github.com/python/cpython/commit/5fbdfc36f397ad46f4057d527855dfacb77242ce
msg291702 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-15 05:25
New changeset d5fa5f3ce7d9003bbd3975d1bf634043305ae18f by Xiang Zhang in branch '3.6':
bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130) (#1150)
https://github.com/python/cpython/commit/d5fa5f3ce7d9003bbd3975d1bf634043305ae18f
msg291703 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-15 05:28
New changeset 4f43f87b6246e13e0eefc793a2c5415c915723c3 by Xiang Zhang in branch '3.5':
bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130) (#1151)
https://github.com/python/cpython/commit/4f43f87b6246e13e0eefc793a2c5415c915723c3
History
Date User Action Args
2017-04-15 05:28:43xiang.zhangsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-04-15 05:28:10xiang.zhangsetmessages: + msg291703
2017-04-15 05:25:17xiang.zhangsetmessages: + msg291702
2017-04-15 05:18:24xiang.zhangsetmessages: + msg291701
2017-04-15 05:03:49xiang.zhangsetpull_requests: + pull_request1283
2017-04-15 04:57:45xiang.zhangsetpull_requests: + pull_request1282
2017-04-15 04:56:19xiang.zhangsetpull_requests: + pull_request1281
2017-04-15 04:47:30xiang.zhangsetmessages: + msg291699
2017-04-14 07:43:22serhiy.storchakasetnosy: + benjamin.peterson, stutzbach, serhiy.storchaka
2017-04-14 06:54:11xiang.zhangsetpull_requests: + pull_request1264
2017-04-14 06:45:23xiang.zhangcreate