Hi, the following patch tries to fix the LOAD_CONST POP_TOP optimization lost in 2.5 (bug #1333982). An example for this is: def f(): 'a' # docstring 'b' Georg PS: Hmm. While looking, I see that 2.4 doesn't optimize away other constants like def g(): 1 Index: Python/compile.c =================================================================== --- Python/compile.c (Revision 47150) +++ Python/compile.c (Arbeitskopie) @@ -775,10 +775,16 @@ } break; + case LOAD_CONST: + cumlc = lastlc + 1; + /* Skip over LOAD_CONST POP_TOP */ + if (codestr[i+3] == POP_TOP) { + memset(codestr+i, NOP, 4); + cumlc = 0; + break; + } /* Skip over LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP */ - case LOAD_CONST: - cumlc = lastlc + 1; j = GETARG(codestr, i); if (codestr[i+3] != JUMP_IF_FALSE || codestr[i+6] != POP_TOP ||
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4