diff options
author | Mark Shannon <mark@hotpy.org> | 2019-11-21 09:11:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 09:11:43 (GMT) |
commit | fee552669f21ca294f57fe0df826945edc779090 (patch) | |
tree | 13b461df5a1231220b8f72c197d2731e9cb88d85 /Lib/opcode.py | |
parent | 5dcc06f6e0d7b5d6589085692b86c63e35e2325e (diff) | |
download | cpython-fee552669f21ca294f57fe0df826945edc779090.zip cpython-fee552669f21ca294f57fe0df826945edc779090.tar.gz cpython-fee552669f21ca294f57fe0df826945edc779090.tar.bz2 |
Produce cleaner bytecode for 'with' and 'async with' by generating separate code for normal and exceptional paths. (#6641)
Remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes. Implement finally blocks by code duplication.
Reimplement frame.lineno setter using line numbers rather than bytecode offsets.
Diffstat (limited to 'Lib/opcode.py')
-rw-r--r-- | Lib/opcode.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py index 0ae0068..1898a38 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -84,10 +84,12 @@ def_op('BINARY_TRUE_DIVIDE', 27) def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) +def_op('RERAISE', 48) +def_op('WITH_EXCEPT_START', 49) def_op('GET_AITER', 50) def_op('GET_ANEXT', 51) def_op('BEFORE_ASYNC_WITH', 52) -def_op('BEGIN_FINALLY', 53) + def_op('END_ASYNC_FOR', 54) def_op('INPLACE_ADD', 55) def_op('INPLACE_SUBTRACT', 56) @@ -115,14 +117,13 @@ def_op('INPLACE_RSHIFT', 76) def_op('INPLACE_AND', 77) def_op('INPLACE_XOR', 78) def_op('INPLACE_OR', 79) -def_op('WITH_CLEANUP_START', 81) -def_op('WITH_CLEANUP_FINISH', 82) + def_op('RETURN_VALUE', 83) def_op('IMPORT_STAR', 84) def_op('SETUP_ANNOTATIONS', 85) def_op('YIELD_VALUE', 86) def_op('POP_BLOCK', 87) -def_op('END_FINALLY', 88) + def_op('POP_EXCEPT', 89) HAVE_ARGUMENT = 90 # Opcodes from here have an argument: @@ -210,7 +211,5 @@ def_op('BUILD_TUPLE_UNPACK_WITH_CALL', 158) name_op('LOAD_METHOD', 160) def_op('CALL_METHOD', 161) -jrel_op('CALL_FINALLY', 162) -def_op('POP_FINALLY', 163) del def_op, name_op, jrel_op, jabs_op |