diff options
author | Mark Shannon <mark@hotpy.org> | 2019-11-21 09:11:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 09:11:43 +0000 |
commit | fee552669f21ca294f57fe0df826945edc779090 (patch) | |
tree | 13b461df5a1231220b8f72c197d2731e9cb88d85 /Lib/importlib | |
parent | 5dcc06f6e0d7b5d6589085692b86c63e35e2325e (diff) | |
download | cpython-git-fee552669f21ca294f57fe0df826945edc779090.tar.gz |
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/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap_external.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 825ed77c3d..d62c6cb77c 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -272,6 +272,8 @@ _code_type = type(_write_atomic.__code__) # only args in ast.arguments #37593) # Python 3.8b4 3413 (Fix "break" and "continue" in "finally" #37830) # Python 3.9a0 3420 (add LOAD_ASSERTION_ERROR #34880) +# Python 3.9a0 3421 (simplified bytecode for with blocks #32949) +# Python 3.9a0 3422 (remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY, POP_FINALLY bytecodes #33387) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -280,7 +282,7 @@ _code_type = type(_write_atomic.__code__) # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3420).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3422).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' |