Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-101892 : Updated Cython/objects/iterobject.c Line 217
Updated Cython/objects/iterobject.c Line 217
  • Loading branch information
workingpayload committed Feb 14, 2023
commit de17a828d543975215daf97b46df96e80774a414
2 changes: 1 addition & 1 deletion Objects/iterobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ calliter_iternext(calliterobject *it)
}

result = _PyObject_CallNoArgs(it->it_callable);
if (result != NULL) {
if (result != NULL && it->it_callable != NULL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, but this won't fix it. Notice the first if statement in the function. If it->it_callable == NULL is true, NULL is returned. So it->it_callable != NULL is already guaranteed at this point.

Copy link
Copy Markdown
Contributor Author

@workingpayload workingpayload Feb 15, 2023

Choose a reason for hiding this comment

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

What if we check it->it_sentinel != NULL ?

int ok;

ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ);
Expand Down