◐ Shell
clean mode source ↗

bpo-37271: Optimize bytecode multiple times until it cannot be optimized further by pablogsal · Pull Request #14068 · python/cpython

@nedbat

@pablogsal

@nedbat Sure, I will talk with Victor to see if we can push it forward.

@pablogsal pablogsal changed the title Optimize bytecode multiple times until it cannot be optimized further bpo-37271: Optimize bytecode multiple times until it cannot be optimized further

Jun 14, 2019

@pablogsal pablogsal marked this pull request as ready for review

June 14, 2019 02:00

@pablogsal

ZackerySpytz

@pablogsal

I have rebased and address the feedback. Also, I have added a max cap of iterations (although is not needed, it can be proven that the while loop will always finish) to make sure the time expended in the loop is always bounded.

Co-Authored-By: Zackery Spytz <zspytz@gmail.com>

markshannon

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, just a couple of questions.

@pablogsal

@markshannon I have added some comments as requested, check if they look good to you :)

@pablogsal

@pablogsal

This is the code that is failing the assert currently:

def f(cond1, cond2):
    while 1:
        return 3
    while 1:
        return 5
    return 6

@Yhg1s