mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
@ -1538,7 +1538,7 @@ class TestSourcePositions(unittest.TestCase):
|
|||
ccc == 1000000), "error msg"
|
||||
""")
|
||||
compiled_code, _ = self.check_positions_against_ast(snippet)
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'LOAD_ASSERTION_ERROR',
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'LOAD_COMMON_CONSTANT',
|
||||
line=1, end_line=3, column=0, end_column=36, occurrence=1)
|
||||
# The "error msg":
|
||||
self.assertOpcodeSourcePositionIs(compiled_code, 'LOAD_CONST',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue