Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
kumaraditya303 merged 12 commits intopython:mainfromkumaraditya303:critical-ctypes
Mar 30, 2025

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303kumaraditya303 commentedMar 25, 2025
edited
Loading

In free-threading, concurrent mutations to StgInfo is not thread safe. Therefore to make it thread safe, when modifying StgInfo, this PR addsSTGINFO_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

@bedevere-bot
Copy link

🤖 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.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelMar 25, 2025
Copy link
Contributor

@colesburycolesbury left a 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.

@kumaraditya303kumaraditya303 merged commitbc5a028 intopython:mainMar 30, 2025
41 checks passed
@kumaraditya303kumaraditya303 deleted the critical-ctypes branchMarch 30, 2025 09:52
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou left review comments

@colesburycolesburycolesbury approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Race in stgdict PyCStructUnionType_update_stginfo under free-threading Race in ctypes PyCFuncPtr_new under free-threading
4 participants
@kumaraditya303@bedevere-bot@encukou@colesbury

[8]ページ先頭

©2009-2025 Movatter.jp