Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing iter(self) in _io._IOBase.readlines #74254

Closed
zhangyangyu opened this issue Apr 14, 2017 · 5 comments
Closed

missing iter(self) in _io._IOBase.readlines #74254

zhangyangyu opened this issue Apr 14, 2017 · 5 comments
Labels
3.7 (EOL) end of life topic-IO type-bug An unexpected behavior, bug, or error

Comments

@zhangyangyu
Copy link
Member

BPO 30068
Nosy @benjaminp, @serhiy-storchaka, @zhangyangyu
PRs
  • bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present #1130
  • [3.6] bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present #1150
  • [3.5] bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present #1151
  • [2.7] bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present #1152
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-04-15.05:28:43.133>
    created_at = <Date 2017-04-14.06:45:23.916>
    labels = ['type-bug', '3.7', 'expert-IO']
    title = 'missing iter(self) in _io._IOBase.readlines'
    updated_at = <Date 2017-04-15.05:28:43.132>
    user = 'https://github.com/zhangyangyu'

    bugs.python.org fields:

    activity = <Date 2017-04-15.05:28:43.132>
    actor = 'xiang.zhang'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-04-15.05:28:43.133>
    closer = 'xiang.zhang'
    components = ['IO']
    creation = <Date 2017-04-14.06:45:23.916>
    creator = 'xiang.zhang'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30068
    keywords = []
    message_count = 5.0
    messages = ['291641', '291699', '291701', '291702', '291703']
    nosy_count = 4.0
    nosy_names = ['benjamin.peterson', 'stutzbach', 'serhiy.storchaka', 'xiang.zhang']
    pr_nums = ['1130', '1150', '1151', '1152']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30068'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @zhangyangyu
    Copy link
    Member Author

    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'

    @zhangyangyu zhangyangyu added 3.7 (EOL) end of life topic-IO type-bug An unexpected behavior, bug, or error labels Apr 14, 2017
    @zhangyangyu
    Copy link
    Member Author

    New changeset 026435c by Xiang Zhang in branch 'master':
    bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (bpo-1130)
    026435c

    @zhangyangyu
    Copy link
    Member Author

    New changeset 5fbdfc3 by Xiang Zhang in branch '2.7':
    bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (bpo-1152)
    5fbdfc3

    @zhangyangyu
    Copy link
    Member Author

    New changeset d5fa5f3 by Xiang Zhang in branch '3.6':
    bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (bpo-1130) (bpo-1150)
    d5fa5f3

    @zhangyangyu
    Copy link
    Member Author

    New changeset 4f43f87 by Xiang Zhang in branch '3.5':
    bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (bpo-1130) (bpo-1151)
    4f43f87

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant