mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
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).
This commit is contained in:
parent
e60892f9db
commit
22863df7ca
14 changed files with 277 additions and 247 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue