FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-32477: Move jumps optimization from the peepholer to the compiler. by serhiy-storchaka · Pull Request #5077 · python/cpython · GitHub

Repository navigation

Prev Previous commit
Next Next commit
Add more tests.
  • Loading branch information
serhiy-storchaka committed Jun 14, 2019
commit ca043f604a936153ff901cc2739920f5a49c06c4
24 changes: 16 additions & 8 deletions Lib/test/test_peepholer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,32 @@ def f(cond, true_value, false_value):

def test_elim_jump_to_uncond_jump(self):
# POP_JUMP_IF_FALSE to JUMP_FORWARD --> POP_JUMP_IF_FALSE to non-jump
# JUMP_FORWARD to JUMP_FORWARD --> JUMP_FORWARD to non-jump
def f():
if a:
# Intentionally use two-line expression to test issue37213.
if (c
or d):
foo()
if b:
# Intentionally use two-line expression to test issue37213.
if (c
or d):
foo()
else:
bar()
else:
baz()
self.check_jump_targets(f)

def test_elim_jump_to_uncond_jump2(self):
# POP_JUMP_IF_FALSE to JUMP_ABSOLUTE --> POP_JUMP_IF_FALSE to non-jump
# JUMP_FORWARD to JUMP_ABSOLUTE --> JUMP_FORWARD to non-jump
def f():
while a:
# Intentionally use two-line expression to test issue37213.
if (c
or d):
a = foo()
if b:
# Intentionally use two-line expression to test issue37213.
if (c
or d):
a = foo()
else:
a = bar()
self.check_jump_targets(f)

def test_elim_jump_to_uncond_jump3(self):
Expand Down

Back | FazBrowse Home | New Git URL