Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python/cpython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: eendebakpt/cpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: store-fast-load-fast-borrow
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 19 files changed
  • 2 contributors

Commits on Oct 29, 2026

  1. Tools/cases_generator: handle super-instructions with uneven componen…

    …t names
    
    The expansion-table generator split a super-instruction's name into its two
    component instructions by assuming both halves have the same number of
    underscore-separated parts (len(pieces) % 2 == 0, split at the midpoint).
    That only holds when both components have equal part counts, e.g.
    LOAD_FAST_BORROW_LOAD_FAST_BORROW. It breaks for a super-instruction fusing
    components of unequal length, e.g. LOAD_FAST_BORROW + LOAD_CONST, raising
    "... doesn't look like a super-instr".
    
    Instead, try every split point and pick the one where both halves are valid
    instruction names. No change to generated output for the current set of
    super-instructions; this only makes the generator robust to future fused
    pairs whose components differ in underscore-part count.
    
    Add a regression test (test_generated_cases.TestExpansionTable) covering both
    the uneven split (OP_A_B + OP_C) and the classic even split (OP_X + OP_X).
    The uneven case fails on the old midpoint-split generator and passes now.
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
    eendebakpt and claude committed Oct 29, 2026
    Configuration menu
    Copy the full SHA
    488b507 View commit details
    Browse the repository at this point in the history
  2. Replace STORE_FAST_LOAD_FAST with STORE_FAST_LOAD_FAST_BORROW

    The compiler fused STORE_FAST followed by LOAD_FAST on the same line into
    STORE_FAST_LOAD_FAST, but the load-fast borrow pass had no borrowed form
    of that superinstruction, so the loaded value always got a strong
    reference. On the free-threaded build this means a one-line loop body
    such as `for x in it: f(x)` increments the shared refcount of `f` on
    every iteration from every thread, while the same loop written over two
    lines borrows it.
    
    Replace the superinstruction with STORE_FAST_LOAD_FAST_BORROW, which is
    created after the borrow analysis from a STORE_FAST; LOAD_FAST_BORROW
    pair. A pair whose load must keep a strong reference is left unfused.
    
    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    eendebakpt and claude committed Oct 29, 2026
    Configuration menu
    Copy the full SHA
    385c1d5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5eda4c7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    061ded8 View commit details
    Browse the repository at this point in the history
Loading