summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-05-30 14:11:42 (GMT)
committerGitHub <noreply@github.com>2025-05-30 14:11:42 (GMT)
commitce6a6371a23dc57ed4257eb102ebfb2827477abf (patch)
treeec978baf587fea71499734367ed0e58ee2d33ba6 /Python
parentc600310663277e24607890298e6d9bf7e1d4f584 (diff)
downloadcpython-ce6a6371a23dc57ed4257eb102ebfb2827477abf.zip
cpython-ce6a6371a23dc57ed4257eb102ebfb2827477abf.tar.gz
cpython-ce6a6371a23dc57ed4257eb102ebfb2827477abf.tar.bz2
GH-134879: Fix `INSTRUMENT_FOR_ITER` for list/tuple (#134897)
Fix INSTRUMENT_FOR_ITER for list/tuple
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c2
-rw-r--r--Python/generated_cases.c.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index a1f8d36..f02e32f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3130,7 +3130,6 @@ dummy_func(
if (PyStackRef_IsTaggedInt(null_or_index)) {
next = _PyForIter_NextWithIndex(iter_o, null_or_index);
if (PyStackRef_IsNull(next)) {
- null_or_index = PyStackRef_TagInt(-1);
JUMPBY(oparg + 1);
DISPATCH();
}
@@ -3191,6 +3190,7 @@ dummy_func(
JUMPBY(oparg + 1);
DISPATCH();
}
+ null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
INSTRUMENTED_JUMP(this_instr, next_instr, PY_MONITORING_EVENT_BRANCH_LEFT);
}
else {
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 5be2671..e3cd3b7 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -5759,9 +5759,7 @@
next = _PyForIter_NextWithIndex(iter_o, null_or_index);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (PyStackRef_IsNull(next)) {
- null_or_index = PyStackRef_TagInt(-1);
JUMPBY(oparg + 1);
- stack_pointer[-1] = null_or_index;
DISPATCH();
}
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
@@ -7070,6 +7068,7 @@
JUMPBY(oparg + 1);
DISPATCH();
}
+ null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
INSTRUMENTED_JUMP(this_instr, next_instr, PY_MONITORING_EVENT_BRANCH_LEFT);
}
else {
@@ -7099,6 +7098,7 @@
DISPATCH();
}
}
+ stack_pointer[-1] = null_or_index;
stack_pointer[0] = next;
stack_pointer += 1;
assert(WITHIN_STACK_BOUNDS());