Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b9572c3

Browse files
committed
Removed bytecode transformation for sequence packing/unpacking.
It depended on the previously removed basic block checker to prevent a jump into the middle of the transformed block. Clears SF 757818: tuple assignment -- SystemError: unknown opcode
1 parent 7c0d7ba commit b9572c3

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

Python/compile.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -363,34 +363,6 @@ optimize_code(PyObject *code, PyObject* consts)
363363
SETARG(codestr, i, 4);
364364
break;
365365

366-
/* Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2 JMP+2.
367-
Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2 JMP+1.
368-
Note, these opcodes occur together only in assignment
369-
statements. Accordingly, the unpack opcode is never
370-
a jump target. */
371-
case BUILD_TUPLE:
372-
case BUILD_LIST:
373-
if (codestr[i+3] != UNPACK_SEQUENCE)
374-
continue;
375-
if (GETARG(codestr, i) == 2 && \
376-
GETARG(codestr, i+3) == 2) {
377-
codestr[i] = ROT_TWO;
378-
codestr[i+1] = JUMP_FORWARD;
379-
SETARG(codestr, i+1, 2);
380-
codestr[i+4] = DUP_TOP; /* Filler codes used as NOPs */
381-
codestr[i+5] = POP_TOP;
382-
continue;
383-
}
384-
if (GETARG(codestr, i) == 3 && \
385-
GETARG(codestr, i+3) == 3) {
386-
codestr[i] = ROT_THREE;
387-
codestr[i+1] = ROT_TWO;
388-
codestr[i+2] = JUMP_FORWARD;
389-
SETARG(codestr, i+2, 1);
390-
codestr[i+5] = DUP_TOP;
391-
}
392-
break;
393-
394366
/* Replace jumps to unconditional jumps */
395367
case FOR_ITER:
396368
case JUMP_FORWARD:

0 commit comments

Comments
 (0)