mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-94485: Set line number of module's RESUME instruction to 0 as specified by PEP 626 (GH-94552) (GH-94562)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Mark Shannon <mark@hotpy.org>
(cherry picked from commit 324d01944d
)
This commit is contained in:
parent
0615e7f9bb
commit
1bfe83a114
7 changed files with 32 additions and 25 deletions
|
@ -272,7 +272,7 @@ Disassembly of g:
|
|||
expr_str = "x + 1"
|
||||
|
||||
dis_expr_str = """\
|
||||
RESUME 0
|
||||
0 RESUME 0
|
||||
|
||||
1 LOAD_NAME 0 (x)
|
||||
LOAD_CONST 0 (1)
|
||||
|
@ -283,7 +283,7 @@ dis_expr_str = """\
|
|||
simple_stmt_str = "x = x + 1"
|
||||
|
||||
dis_simple_stmt_str = """\
|
||||
RESUME 0
|
||||
0 RESUME 0
|
||||
|
||||
1 LOAD_NAME 0 (x)
|
||||
LOAD_CONST 0 (1)
|
||||
|
@ -302,7 +302,7 @@ lst[fun(0)]: int = 1
|
|||
# leading newline is for a reason (tests lineno)
|
||||
|
||||
dis_annot_stmt_str = """\
|
||||
RESUME 0
|
||||
0 RESUME 0
|
||||
|
||||
2 SETUP_ANNOTATIONS
|
||||
LOAD_CONST 0 (1)
|
||||
|
@ -342,7 +342,7 @@ while 1:
|
|||
# Trailing newline has been deliberately omitted
|
||||
|
||||
dis_compound_stmt_str = """\
|
||||
RESUME 0
|
||||
0 RESUME 0
|
||||
|
||||
1 LOAD_CONST 0 (0)
|
||||
STORE_NAME 0 (x)
|
||||
|
@ -954,7 +954,7 @@ class DisTests(DisTestBase):
|
|||
@cpython_only
|
||||
def test_binary_specialize(self):
|
||||
binary_op_quicken = """\
|
||||
0 RESUME_QUICK 0
|
||||
0 0 RESUME_QUICK 0
|
||||
|
||||
1 2 LOAD_NAME 0 (a)
|
||||
4 LOAD_NAME 1 (b)
|
||||
|
@ -972,7 +972,7 @@ class DisTests(DisTestBase):
|
|||
self.do_disassembly_compare(got, binary_op_quicken % "BINARY_OP_ADD_UNICODE 0 (+)", True)
|
||||
|
||||
binary_subscr_quicken = """\
|
||||
0 RESUME_QUICK 0
|
||||
0 0 RESUME_QUICK 0
|
||||
|
||||
1 2 LOAD_NAME 0 (a)
|
||||
4 LOAD_CONST 0 (0)
|
||||
|
@ -992,7 +992,7 @@ class DisTests(DisTestBase):
|
|||
@cpython_only
|
||||
def test_load_attr_specialize(self):
|
||||
load_attr_quicken = """\
|
||||
0 RESUME_QUICK 0
|
||||
0 0 RESUME_QUICK 0
|
||||
|
||||
1 2 LOAD_CONST 0 ('a')
|
||||
4 LOAD_ATTR_SLOT 0 (__class__)
|
||||
|
@ -1006,7 +1006,7 @@ class DisTests(DisTestBase):
|
|||
@cpython_only
|
||||
def test_call_specialize(self):
|
||||
call_quicken = """\
|
||||
0 RESUME_QUICK 0
|
||||
0 0 RESUME_QUICK 0
|
||||
|
||||
1 2 PUSH_NULL
|
||||
4 LOAD_NAME 0 (str)
|
||||
|
@ -1595,7 +1595,7 @@ class InstructionTests(InstructionTestCase):
|
|||
for instr in dis.get_instructions(code)
|
||||
]
|
||||
expected = [
|
||||
(None, None, None, None),
|
||||
(0, 1, 0, 0),
|
||||
(1, 1, 0, 1),
|
||||
(1, 1, 0, 1),
|
||||
(2, 2, 2, 3),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue