8000 GH-98363: Fix exception handling in batched() by rhettinger · Pull Request #98523 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-98363: Fix exception handling in batched() #98523

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

Merged
merged 5 commits into from
Oct 21, 2022
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
Prev Previous commit
Loop invariant code motion: hoist ob_item lookup out of the loop.
  • Loading branch information
rhettinger committed Oct 21, 2022
commit 4b74a0b1b38d076642b90dc83f073d1a1bf3cda6
3 changes: 2 additions & 1 deletion Modules/itertoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,13 @@ batched_next(batchedobject *bo)
return NULL;
}
iternextfunc iternext = *Py_TYPE(it)->tp_iternext;
PyObject **items = PySequence_Fast_ITEMS(result);
for (i=0 ; i < n ; i++) {
item = iternext(it);
if (item == NULL) {
goto null_item;
}
PyList_SET_ITEM(result, i, item);
items[i] = item;
}
return result;

Expand Down
0