mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-101632: Add the new RETURN_CONST opcode (#101633)
This commit is contained in:
parent
0d3d5007b1
commit
753fc8a5d6
19 changed files with 186 additions and 154 deletions
|
@ -117,7 +117,7 @@ class TestTranforms(BytecodeTestCase):
|
|||
return None
|
||||
|
||||
self.assertNotInBytecode(f, 'LOAD_GLOBAL')
|
||||
self.assertInBytecode(f, 'LOAD_CONST', None)
|
||||
self.assertInBytecode(f, 'RETURN_CONST', None)
|
||||
self.check_lnotab(f)
|
||||
|
||||
def test_while_one(self):
|
||||
|
@ -134,7 +134,7 @@ class TestTranforms(BytecodeTestCase):
|
|||
|
||||
def test_pack_unpack(self):
|
||||
for line, elem in (
|
||||
('a, = a,', 'LOAD_CONST',),
|
||||
('a, = a,', 'RETURN_CONST',),
|
||||
('a, b = a, b', 'SWAP',),
|
||||
('a, b, c = a, b, c', 'SWAP',),
|
||||
):
|
||||
|
@ -165,7 +165,7 @@ class TestTranforms(BytecodeTestCase):
|
|||
# One LOAD_CONST for the tuple, one for the None return value
|
||||
load_consts = [instr for instr in dis.get_instructions(code)
|
||||
if instr.opname == 'LOAD_CONST']
|
||||
self.assertEqual(len(load_consts), 2)
|
||||
self.assertEqual(len(load_consts), 1)
|
||||
self.check_lnotab(code)
|
||||
|
||||
# Bug 1053819: Tuple of constants misidentified when presented with:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue