diff options
author | Mark Shannon <mark@hotpy.org> | 2023-01-24 17:25:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 17:25:37 (GMT) |
commit | f02fa64bf2d03ef7a28650c164e17a5fb5d8543d (patch) | |
tree | a794d0afb47c84bf9a77d4feaa26e8e1fb23be07 /Lib/importlib | |
parent | daec3a463c747c852d7ee91e82770fb1763d7d31 (diff) | |
download | cpython-f02fa64bf2d03ef7a28650c164e17a5fb5d8543d.zip cpython-f02fa64bf2d03ef7a28650c164e17a5fb5d8543d.tar.gz cpython-f02fa64bf2d03ef7a28650c164e17a5fb5d8543d.tar.bz2 |
GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. (GH-101013)
* Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap_external.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 5a8cbb9..cd44d00 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -429,7 +429,8 @@ _code_type = type(_write_atomic.__code__) # Python 3.12a1 3513 (Add CALL_INTRINSIC_1 instruction, removed STOPITERATION_ERROR, PRINT_EXPR, IMPORT_STAR) # Python 3.12a1 3514 (Remove ASYNC_GEN_WRAP, LIST_TO_TUPLE, and UNARY_POSITIVE) # Python 3.12a1 3515 (Embed jump mask in COMPARE_OP oparg) -# Python 3.12a1 3516 (Add COMAPRE_AND_BRANCH instruction) +# Python 3.12a1 3516 (Add COMPARE_AND_BRANCH instruction) +# Python 3.12a1 3517 (Change YIELD_VALUE oparg to exception block depth) # Python 3.13 will start with 3550 @@ -442,7 +443,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 = (3516).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3517).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c |