diff options
author | Mark Shannon <mark@hotpy.org> | 2022-10-27 10:55:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 10:55:03 (GMT) |
commit | 22863df7ca5f9cd01a40ab3dce3d067ec5666081 (patch) | |
tree | 73c460d80f41b45a331b7d886defe39127e12472 /Lib/importlib | |
parent | e60892f9db1316dbabf7a652d7648e4f968b745d (diff) | |
download | cpython-22863df7ca5f9cd01a40ab3dce3d067ec5666081.zip cpython-22863df7ca5f9cd01a40ab3dce3d067ec5666081.tar.gz cpython-22863df7ca5f9cd01a40ab3dce3d067ec5666081.tar.bz2 |
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap_external.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index fc50e705..9c14f71 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -423,6 +423,7 @@ _code_type = type(_write_atomic.__code__) # Python 3.12a1 3507 (Set lineno of module's RESUME to 0) # Python 3.12a1 3508 (Add CLEANUP_THROW) # Python 3.12a1 3509 (Conditional jumps only jump forward) +# Python 3.12a1 3510 (FOR_ITER leaves iterator on the stack) # Python 3.13 will start with 3550 @@ -435,7 +436,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 = (3509).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3510).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c |