Repository navigation
Conversation
Fixes the free-threaded deadlock described in pythongh-158195 by removing type-lock pinning. The type lock and class dict lock can now be released normally while a thread waits to stop the world, rather than remaining pinned across that wait.
Avoid changing the default build behaviour. The following changes are now only for the free-threaded build: - fresh __bases__ tuple copying - type_new_copy_dict() and namespace-key normalization - addition of the new exact-Unicode dictionary helpers In the default build, you can still create a type with string-subclass keys.
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the free-threaded deadlock described in gh-158195 by removing type-lock pinning. The type lock and class dict lock can now be released normally while a thread waits to stop the world, rather than remaining pinned across that wait.
This backport has a modification of GH-159972: avoid changing the default build behaviour. The following changes are now only for the free-threaded build:
__bases__tuple copyingtype_new_copy_dict()and namespace-key normalizationThis means that in the default build, you can still create a type with string-subclass keys. I'm not sure any code actually does that but it seems safer not to change that in a bugfix release.