-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-101892: Fix SystemError when a callable iterator call exhausts the iterator #101896
Changes from 6 commits
de17a82
3fba831
bee2af7
25f4c06
0c631e3
506fb6a
78168bf
188e388
0f9cea1
6abb09a
c8b6bad
6931c20
36b043c
340f668
fe1502d
b9065d9
cc2066b
27e478f
1ee2293
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Callable iterators no longer raise :class:`SystemError` by exhausting themselves. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,7 +214,7 @@ calliter_iternext(calliterobject *it) | |
} | ||
|
||
result = _PyObject_CallNoArgs(it->it_callable); | ||
if (result != NULL) { | ||
if (result != NULL && it->it_callable != NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, but this won't fix it. Notice the first There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if we check |
||
int ok; | ||
|
||
ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behaviour here?
StopIteration
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for noticing the oversight! Fixed.