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: bytes-join-exact-fast
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 2 contributors

Commits on Oct 10, 2026

  1. Add a fast path to bytes.join() for exact bytes items

    When all items are exact bytes objects, copy straight from the items
    instead of building a Py_buffer and taking a reference for each one,
    and store a one-byte separator directly.
    
    The fast path is used when the GIL is not released during the copy:
    results below the existing 1 MiB threshold in the default build, and
    results of any size in the free-threaded build, where the caller holds
    the critical section of the sequence.
    
    In the general path, release exact bytes items with a plain decref:
    bytes has no bf_releasebuffer, so PyBuffer_Release() does nothing more.
    
    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    eendebakpt and claude committed Oct 10, 2026
    Configuration menu
    Copy the full SHA
    bd22495 View commit details
    Browse the repository at this point in the history
Loading