mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
gh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321)
The PEP 649 implementation will require a way to load NotImplementedError from the bytecode. @markshannon suggested implementing this by converting LOAD_ASSERTION_ERROR into a more general mechanism for loading constants. This PR adds this new opcode. I will work on the rest of the implementation of the PEP separately. Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
506b1a3ff6
commit
98e855fcc1
22 changed files with 337 additions and 288 deletions
|
@ -472,8 +472,9 @@ _code_type = type(_write_atomic.__code__)
|
|||
# Python 3.13a1 3568 (Change semantics of END_FOR)
|
||||
# Python 3.13a5 3569 (Specialize CONTAINS_OP)
|
||||
# Python 3.13a6 3570 (Add __firstlineno__ class attribute)
|
||||
# Python 3.14a1 3600 (Add LOAD_COMMON_CONSTANT)
|
||||
|
||||
# Python 3.14 will start with 3600
|
||||
# Python 3.15 will start with 3700
|
||||
|
||||
# Please don't copy-paste the same pre-release tag for new entries above!!!
|
||||
# You should always use the *upcoming* tag. For example, if 3.12a6 came out
|
||||
|
@ -488,7 +489,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 = (3570).to_bytes(2, 'little') + b'\r\n'
|
||||
MAGIC_NUMBER = (3571).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