Skip to content

bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present#1130

Merged
zhangyangyu merged 6 commits into
python:masterfrom
zhangyangyu:bpo-30068
Apr 15, 2017
Merged

bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present#1130
zhangyangyu merged 6 commits into
python:masterfrom
zhangyangyu:bpo-30068

Conversation

@zhangyangyu
Copy link
Copy Markdown
Member

No description provided.

@zhangyangyu zhangyangyu added type-bug An unexpected behavior, bug, or error needs backport to 2.7 labels Apr 14, 2017
@mention-bot
Copy link
Copy Markdown

@zhangyangyu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @serhiy-storchaka and @ezio-melotti to be potential reviewers.

Comment thread Modules/_io/iobase.c Outdated
while (1) {
PyObject *line = PyIter_Next(self);
PyObject *it, *line;
it = PyObject_GetIter(self);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be outside of the loop.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My foolish.

Comment thread Misc/NEWS Outdated
- bpo-30068: _io._IOBase.readlines will check if it's closed first when
hint is present.

- bpo-29692: Fixed arbitrary unchaining of RuntimeError exceptions in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better not move this entry.

Comment thread Modules/_io/iobase.c
return result;
}

it = PyObject_GetIter(self);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is leaked.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread Modules/_io/iobase.c
}
Py_DECREF(it);
return result;
error:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: I prefer to add an empty line after return and before a label.

@zhangyangyu zhangyangyu merged commit 026435c into python:master Apr 15, 2017
@zhangyangyu zhangyangyu deleted the bpo-30068 branch April 15, 2017 04:47
zhangyangyu added a commit to zhangyangyu/cpython that referenced this pull request Apr 15, 2017
zhangyangyu added a commit to zhangyangyu/cpython that referenced this pull request Apr 15, 2017
zhangyangyu added a commit to zhangyangyu/cpython that referenced this pull request Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants