Skip to content

gh-145685: Stop the world when updating MRO of existing types#145707

Merged
colesbury merged 1 commit intopython:mainfrom
colesbury:gh-145685-stw-mro-update
Mar 9, 2026
Merged

gh-145685: Stop the world when updating MRO of existing types#145707
colesbury merged 1 commit intopython:mainfrom
colesbury:gh-145685-stw-mro-update

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Mar 9, 2026

We already have a stop-the-world pause elsewhere in this code path (type_set_bases) and this makes will make it easier to avoid contention on the TYPE_LOCK when looking up names in the MRO hierarchy.

Also use deferred reference counting for non-immortal MROs.

We already have a stop-the-world pause elsewhere in this code path
(type_set_bases) and this makes will make it easier to avoid contention
on the TYPE_LOCK when looking up names in the MRO hierarchy.

Also use deferred reference counting for non-immortal MROs.
@colesbury colesbury merged commit 0b65c88 into python:main Mar 9, 2026
58 checks passed
@colesbury colesbury deleted the gh-145685-stw-mro-update branch March 9, 2026 22:41
@colesbury colesbury added the needs backport to 3.14 bugs and security fixes label Mar 9, 2026
@miss-islington-app
Copy link

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @colesbury, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0b65c88c2af6e09530a9aa21800771aa687371db 3.14

colesbury added a commit to colesbury/cpython that referenced this pull request Mar 9, 2026
…types (pythongh-145707)

We already have a stop-the-world pause elsewhere in this code path
(type_set_bases) and this makes will make it easier to avoid contention
on the TYPE_LOCK when looking up names in the MRO hierarchy.

Also use deferred reference counting for non-immortal MROs.
(cherry picked from commit 0b65c88)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 9, 2026

GH-145715 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 9, 2026
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