Skip to content

Commit c8877e4

Browse files
Respect op caches.
1 parent 88f7beb commit c8877e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/codeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ identify_unbound_names(PyThreadState *tstate, PyCodeObject *co,
17301730
assert(counts == NULL || counts->total == 0);
17311731
struct co_unbound_counts unbound = {0};
17321732
Py_ssize_t len = Py_SIZE(co);
1733-
for (int i = 0; i < len; i++) {
1733+
for (int i = 0; i < len; i += _PyInstruction_GetLength(co, i)) {
17341734
_Py_CODEUNIT inst = _Py_GetBaseCodeUnit(co, i);
17351735
if (inst.op.code == LOAD_ATTR) {
17361736
int oparg = GET_OPARG(co, i, inst.op.arg);
@@ -1976,7 +1976,7 @@ _PyCode_ReturnsOnlyNone(PyCodeObject *co)
19761976

19771977
// Walk the bytecode, looking for RETURN_VALUE.
19781978
Py_ssize_t len = Py_SIZE(co);
1979-
for (int i = 0; i < len; i++) {
1979+
for (int i = 0; i < len; i += _PyInstruction_GetLength(co, i)) {
19801980
_Py_CODEUNIT inst = _Py_GetBaseCodeUnit(co, i);
19811981
if (IS_RETURN_OPCODE(inst.op.code)) {
19821982
assert(i != 0);

0 commit comments

Comments
 (0)