diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-12-18 11:06:25 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-12-18 11:06:25 (GMT) |
commit | f289ae6f01683689dfd07785c9617175b40aea91 (patch) | |
tree | dd9a6f78817fcedbd95db286188507cf21a52bc0 /Lib | |
parent | 621601a698a285a45231a6fd223db33566dcb842 (diff) | |
download | cpython-f289ae6f01683689dfd07785c9617175b40aea91.zip cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.gz cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.bz2 |
Merged revisions 67818 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67818 | antoine.pitrou | 2008-12-17 01:38:28 +0100 (mer., 17 déc. 2008) | 3 lines
Issue #2183: Simplify and optimize bytecode for list comprehensions.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/opcode.py | 7 | ||||
-rw-r--r-- | Lib/test/test_dis.py | 36 |
2 files changed, 21 insertions, 22 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py index 5fd9c21..9484d1e 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -57,8 +57,6 @@ def_op('UNARY_NOT', 12) def_op('UNARY_INVERT', 15) -def_op('SET_ADD', 17) -def_op('LIST_APPEND', 18) def_op('BINARY_POWER', 19) def_op('BINARY_MULTIPLY', 20) @@ -169,4 +167,9 @@ def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8) def_op('EXTENDED_ARG', 143) EXTENDED_ARG = 143 +def_op('LIST_APPEND', 145) +def_op('SET_ADD', 146) +def_op('MAP_ADD', 147) + + del def_op, name_op, jrel_op, jabs_op diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index cf62ecf..d82dc5a 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -55,29 +55,25 @@ def bug1333982(x=[]): dis_bug1333982 = """\ %-4d 0 LOAD_CONST 1 (0) - 3 JUMP_IF_TRUE 41 (to 47) + 3 JUMP_IF_TRUE 33 (to 39) 6 POP_TOP 7 LOAD_GLOBAL 0 (AssertionError) 10 BUILD_LIST 0 - 13 DUP_TOP - 14 STORE_FAST 1 (_[1]) - 17 LOAD_FAST 0 (x) - 20 GET_ITER - >> 21 FOR_ITER 13 (to 37) - 24 STORE_FAST 2 (s) - 27 LOAD_FAST 1 (_[1]) - 30 LOAD_FAST 2 (s) - 33 LIST_APPEND - 34 JUMP_ABSOLUTE 21 - >> 37 DELETE_FAST 1 (_[1]) - - %-4d 40 LOAD_CONST 2 (1) - 43 BINARY_ADD - 44 RAISE_VARARGS 2 - >> 47 POP_TOP - - %-4d 48 LOAD_CONST 0 (None) - 51 RETURN_VALUE + 13 LOAD_FAST 0 (x) + 16 GET_ITER + >> 17 FOR_ITER 12 (to 32) + 20 STORE_FAST 1 (s) + 23 LOAD_FAST 1 (s) + 26 LIST_APPEND 2 + 29 JUMP_ABSOLUTE 17 + + %-4d >> 32 LOAD_CONST 2 (1) + 35 BINARY_ADD + 36 RAISE_VARARGS 2 + >> 39 POP_TOP + + %-4d 40 LOAD_CONST 0 (None) + 43 RETURN_VALUE """%(bug1333982.__code__.co_firstlineno + 1, bug1333982.__code__.co_firstlineno + 2, bug1333982.__code__.co_firstlineno + 3) |