Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speedup typechecking of nested if expressions #12700

Merged
merged 1 commit into from May 20, 2022

Commits on May 16, 2022

  1. speedup typechecking of nested if expressions

    Deeply nested if/else expressions have a worst-case exponential behavior.
    
    This will for instance manifest when returning literal values which cause
    repeated analysis of conditional branches with subtly different type context
    for each literal.
    
    This can be optimized by observing that a simple literal context will yield
    the same analysis as its fallback type, and likewise, two literals of the
    same fallback type will yield the same analysis. In those case we can avoid
    the repeated analysis and prevent the worst-case exponential behavior.
    
    Fixes python#9591
    huguesb committed May 16, 2022
    Configuration menu
    Copy the full SHA
    2c0209e View commit details
    Browse the repository at this point in the history