Skip to content

gh-116738: Fix thread safety of winreg - #162625

Open
aisk wants to merge 1 commit into
python:mainfrom
aisk:gh-116738-winreg
Open

aisk wants to merge 1 commit into
python:mainfrom
aisk:gh-116738-winreg

Conversation

@aisk

@aisk aisk commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

The key handle is read in the Close() / Detach() methods, then set to zero. On free-threaded builds, a thread may read it before another thread sets it to zero, so a key may be closed / detached multiple times. Using an atomic exchange to read it and set it to zero at once resolves this.

@aisk
aisk requested a review from a team as a code owner November 25, 2026 16:20
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant