Skip to content

[3.15] gh-162752: Skip stop-the-world when a type slot update changes nothing (gh-162763) - #162848

Merged
nascheme merged 1 commit into
python:3.15from
nascheme:gh-162752-slot-fastpath-3.15
Nov 30, 2026
Merged

nascheme merged 1 commit into
python:3.15from
nascheme:gh-162752-slot-fastpath-3.15

Conversation

@nascheme

@nascheme nascheme commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Assigning a special method to a class stopped the world on every assignment, even when no slot changed (e.g. replacing one Python getitem function with another). With other threads contending, each pause could cost about 1 ms. Before stopping the world, compute the new slot values with TYPE_LOCK held and skip the pause if none would change.

(cherry picked from commit c52b7a8)

Co-authored-by: Gregory P. Smith greg@krypto.org

…hanges nothing (pythongh-162763)

Assigning a special method to a class stopped the world on every
assignment, even when no slot changed (e.g. replacing one Python
__getitem__ function with another).  With other threads contending, each
pause could cost about 1 ms.  Before stopping the world, compute the new
slot values with TYPE_LOCK held and skip the pause if none would change.

(cherry picked from commit c52b7a8)
@bedevere-app bedevere-app Bot added topic-free-threading type-bug An unexpected behavior, bug, or error labels Nov 30, 2026
@nascheme
nascheme marked this pull request as ready for review November 30, 2026 03:02
@nascheme nascheme added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 30, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @nascheme for commit c6eba5b 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F162848%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 30, 2026
@nascheme
nascheme merged commit 8547347 into python:3.15 Nov 30, 2026
141 of 144 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-free-threading type-bug An unexpected behavior, bug, or error

2 participants