Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-127945: fix thread safety of creating instances of ctypes structures#131716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bedevere-bot commentedMar 25, 2025
🤖 New build scheduled with the buildbot fleet by@kumaraditya303 for commitb0e06a0 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131716%2Fmerge If you want to schedule another build, you need to add the🔨 test-with-buildbots label again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks great! A few minor comments.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bc5a028
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ctypes
thread safety auditing (and fixing) #127945In free-threading, concurrent mutations to StgInfo is not thread safe. Therefore to make it thread safe, when modifying StgInfo, this PR adds
STGINFO_LOCK
andSTGINFO_UNLOCK
macros which are used to acquire critical section of the StgInfo. The critical section is write only and is acquired when modifying the StgInfo fields and while setting thedict_final
bit. Once thedict_final
is set, StgInfo is treated as read only and no further modifications are allowed. This allows to avoid acquiring the critical section for most read operations whendict_final
is set (general case).Fixes#128567
Fixes#128570