summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-07-08 13:20:13 (GMT)
committerGitHub <noreply@github.com>2024-07-08 13:20:13 (GMT)
commit8ad6067bd4556afddc86004f8e350aa672fda217 (patch)
tree15a15f25d7d11db22399be2a26ec6e2ae889976c /Python/executor_cases.c.h
parentd69529d31ccd1510843cfac1ab53bb8cb027541f (diff)
downloadcpython-8ad6067bd4556afddc86004f8e350aa672fda217.zip
cpython-8ad6067bd4556afddc86004f8e350aa672fda217.tar.gz
cpython-8ad6067bd4556afddc86004f8e350aa672fda217.tar.bz2
GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 3b99946..8f6bc75 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -3055,8 +3055,11 @@
JUMP_TO_JUMP_TARGET();
}
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
- UOP_STAT_INC(uopcode, miss);
- JUMP_TO_JUMP_TARGET();
+ it->it_index = -1;
+ if (1) {
+ UOP_STAT_INC(uopcode, miss);
+ JUMP_TO_JUMP_TARGET();
+ }
}
break;
}