summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-09-01 10:03:52 (GMT)
committerGitHub <noreply@github.com>2022-09-01 10:03:52 (GMT)
commit894cafd9a53f2423adc6b1fb111006883aeac03c (patch)
tree3118d625cc4b82d8bb617071be218641242af8e1 /Lib
parente93d1bda77b71db7ca150187f841fbb237772b2c (diff)
downloadcpython-894cafd9a53f2423adc6b1fb111006883aeac03c.zip
cpython-894cafd9a53f2423adc6b1fb111006883aeac03c.tar.gz
cpython-894cafd9a53f2423adc6b1fb111006883aeac03c.tar.bz2
gh-93678: apply remove_redundant_jumps in optimize_cfg (GH-96274)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_peepholer.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
index 7ece468..7cd9b06 100644
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -892,7 +892,8 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
self.cfg_optimization_test(insts, expected, consts=list(range(5)))
def test_conditional_jump_forward_const_condition(self):
- # The unreachable branch of the jump is removed
+ # The unreachable branch of the jump is removed, the jump
+ # becomes redundant and is replaced by a NOP (for the lineno)
insts = [
('LOAD_CONST', 3, 11),
@@ -903,8 +904,7 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
]
expected = [
('NOP', None, 11),
- ('JUMP', lbl := self.Label(), 12),
- lbl,
+ ('NOP', None, 12),
('LOAD_CONST', '3', 14)
]
self.cfg_optimization_test(insts, expected, consts=list(range(5)))