summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_peepholer.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-02-28 11:29:32 (GMT)
committerGitHub <noreply@github.com>2023-02-28 11:29:32 (GMT)
commit9f799ab0200f07d762eb8fe822c606e1b4b4866e (patch)
treefdd568649474ada4780ecf8b9d44fc78615f9640 /Lib/test/test_peepholer.py
parent6b2d7c0ddb4d2afe298ee7c8f6a23c400f1465fd (diff)
downloadcpython-9f799ab0200f07d762eb8fe822c606e1b4b4866e.zip
cpython-9f799ab0200f07d762eb8fe822c606e1b4b4866e.tar.gz
cpython-9f799ab0200f07d762eb8fe822c606e1b4b4866e.tar.bz2
gh-87092: Make jump target label equal to the offset of the target in the instructions sequence (#102093)
Diffstat (limited to 'Lib/test/test_peepholer.py')
-rw-r--r--Lib/test/test_peepholer.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
index 707ff82..aea234e 100644
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -984,6 +984,7 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
if expected_consts is None:
expected_consts = consts
opt_insts, opt_consts = self.get_optimized(insts, consts)
+ expected_insts = self.normalize_insts(expected_insts)
self.assertInstructionsMatch(opt_insts, expected_insts)
self.assertEqual(opt_consts, expected_consts)
@@ -996,11 +997,11 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
('LOAD_CONST', 3, 14),
]
expected = [
- ('LOAD_NAME', '1', 11),
+ ('LOAD_NAME', 1, 11),
('POP_JUMP_IF_TRUE', lbl := self.Label(), 12),
- ('LOAD_CONST', '2', 13),
+ ('LOAD_CONST', 2, 13),
lbl,
- ('LOAD_CONST', '3', 14)
+ ('LOAD_CONST', 3, 14)
]
self.cfg_optimization_test(insts, expected, consts=list(range(5)))
@@ -1018,7 +1019,7 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
expected = [
('NOP', None, 11),
('NOP', None, 12),
- ('LOAD_CONST', '3', 14)
+ ('LOAD_CONST', 3, 14)
]
self.cfg_optimization_test(insts, expected, consts=list(range(5)))
@@ -1031,9 +1032,9 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
]
expected = [
lbl := self.Label(),
- ('LOAD_NAME', '1', 11),
+ ('LOAD_NAME', 1, 11),
('POP_JUMP_IF_TRUE', lbl, 12),
- ('LOAD_CONST', '2', 13)
+ ('LOAD_CONST', 2, 13)
]
self.cfg_optimization_test(insts, expected, consts=list(range(5)))