summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-02-22 11:11:57 (GMT)
committerGitHub <noreply@github.com>2023-02-22 11:11:57 (GMT)
commit7c106a443f8cf1111947a425eed11ecf9e615ce3 (patch)
tree37ef7da55ba40c546b530c9dcbf70877d5736ff9 /Python/specialize.c
parent8d46c7ed5e83e22d55fe4f4e6e873d87f340c1dc (diff)
downloadcpython-7c106a443f8cf1111947a425eed11ecf9e615ce3.zip
cpython-7c106a443f8cf1111947a425eed11ecf9e615ce3.tar.gz
cpython-7c106a443f8cf1111947a425eed11ecf9e615ce3.tar.bz2
GH-100982: Restrict `FOR_ITER_RANGE` to a single instruction to allow instrumentation. (GH-101985)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index c9555f8..3405d2b 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -2155,8 +2155,6 @@ _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr, int oparg)
assert(_PyOpcode_Caches[FOR_ITER] == INLINE_CACHE_ENTRIES_FOR_ITER);
_PyForIterCache *cache = (_PyForIterCache *)(instr + 1);
PyTypeObject *tp = Py_TYPE(iter);
- _Py_CODEUNIT next = instr[1+INLINE_CACHE_ENTRIES_FOR_ITER];
- int next_op = _PyOpcode_Deopt[next.op.code];
if (tp == &PyListIter_Type) {
instr->op.code = FOR_ITER_LIST;
goto success;
@@ -2165,7 +2163,7 @@ _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr, int oparg)
instr->op.code = FOR_ITER_TUPLE;
goto success;
}
- else if (tp == &PyRangeIter_Type && next_op == STORE_FAST) {
+ else if (tp == &PyRangeIter_Type) {
instr->op.code = FOR_ITER_RANGE;
goto success;
}