8000 bpo-45026: More compact range iterator (alt) by serhiy-storchaka · Pull Request #28176 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-45026: More compact range iterator (alt) #28176

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

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
8000
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
Next Next commit
Unify code with range-iter.
  • Loading branch information
serhiy-storchaka committed Nov 27, 2022
commit 189ca23ec32e674016073c453c75c44bd54a8bd9
2 changes: 1 addition & 1 deletion Objects/rangeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ rangeiter_next(_PyRangeIterObject *r)
{
if (r->step > 0 ? r->start < r->stop : r->start > r->stop) {
long result = r->start;
r->start += r->step;
r->start = result + r->step;
return PyLong_FromLong(result);
}
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,7 @@ dummy_func(
}
else {
long value = r->start;
r->start += r->step;
r->start = value + r->step;
if (_PyLong_AssignValue(&GETLOCAL(_Py_OPARG(next)), value) < 0) {
goto error;
}
Expand Down
2 changes: 1 addition & 1 deletion Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0