Skip to content

Conversation

DinoV
Copy link
Contributor

@DinoV DinoV commented Aug 29, 2025

In code like:

def x(tz_str):
    try:
        start, end = 1, 2
    except ValueError as e:
        raise Exception()

    return f(start, end)

The compiler ends up producing an empty basic block. When the load fast optimization runs it sees that term == NULL and doesn't fall through to the following block. The end result is that the compiler doesn't properly produce a LOAD_FAST_BORROWED_LOAD_FAST_BORROWED opcode.

The analysis should just use the BB_HAS_FALLTHROUGH macro instead of duplicating the logic.

@DinoV DinoV requested a review from mpage August 29, 2025 18:12
@DinoV DinoV changed the title load fast optimization should fall through to empty blocks gh-138250: load fast optimization should fall through to empty blocks Aug 29, 2025
@DinoV DinoV marked this pull request as ready for review August 29, 2025 18:41
Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

LGTM - fixes a bug and is much cleaner!

@DinoV DinoV merged commit e05182f into python:main Aug 29, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants