Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bec617a

Browse filesBrowse files
committed
Address code review
1 parent a13beed commit bec617a
Copy full SHA for bec617a

File tree

4 files changed

+10
-4
lines changed
Filter options

4 files changed

+10
-4
lines changed
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
For an empty reverse iterator for list will be reduced to :func:`reversed`.
2+
Patch by Donghee Na

‎Python/bytecodes.c

Copy file name to clipboardExpand all lines: Python/bytecodes.c
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,7 @@ dummy_func(
26142614
assert(Py_TYPE(iter) == &PyListIter_Type);
26152615
STAT_INC(FOR_ITER, hit);
26162616
PyListObject *seq = it->it_seq;
2617-
if (seq == NULL || it->it_index >= PyList_GET_SIZE(seq)) {
2617+
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
26182618
#ifndef Py_GIL_DISABLED
26192619
if (seq != NULL) {
26202620
it->it_seq = NULL;
@@ -2635,8 +2635,10 @@ dummy_func(
26352635
_PyListIterObject *it = (_PyListIterObject *)iter;
26362636
assert(Py_TYPE(iter) == &PyListIter_Type);
26372637
PyListObject *seq = it->it_seq;
2638+
#ifndef Py_GIL_DISABLED
26382639
DEOPT_IF(seq == NULL);
2639-
DEOPT_IF(it->it_index >= PyList_GET_SIZE(seq));
2640+
#endif
2641+
DEOPT_IF((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq));
26402642
}
26412643

26422644
op(_ITER_NEXT_LIST, (iter -- iter, next)) {

‎Python/executor_cases.c.h

Copy file name to clipboardExpand all lines: Python/executor_cases.c.h
+3-1Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Python/generated_cases.c.h

Copy file name to clipboardExpand all lines: Python/generated_cases.c.h
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.