Index: Python/compile.c =================================================================== --- Python/compile.c (revision 47196) +++ Python/compile.c (working copy) @@ -775,18 +775,24 @@ } break; + case LOAD_CONST: + j = GETARG(codestr, i); + /* Skip over LOAD_CONST POP_TOP */ + if (codestr[i+3] == POP_TOP && + ISBASICBLOCK(blocks,i,4)) { + memset(codestr+i, NOP, 4); + break; + } /* Skip over LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP */ - case LOAD_CONST: + if (codestr[i+3] == JUMP_IF_FALSE && + codestr[i+6] == POP_TOP && + ISBASICBLOCK(blocks,i,7) && + PyObject_IsTrue(PyList_GET_ITEM(consts, j))) { + memset(codestr+i, NOP, 7); + break; + } cumlc = lastlc + 1; - j = GETARG(codestr, i); - if (codestr[i+3] != JUMP_IF_FALSE || - codestr[i+6] != POP_TOP || - !ISBASICBLOCK(blocks,i,7) || - !PyObject_IsTrue(PyList_GET_ITEM(consts, j))) - continue; - memset(codestr+i, NOP, 7); - cumlc = 0; break; /* Try to fold tuples of constants (includes a case for lists