Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-134637: make PyCFuncPtr_call lock free in ctypes#134702
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
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.
This looks fine for 3.14 backport, but... ideallyctypes
should, where possible, look like a “normal” C extension that a third-party could write.
I'm worried about it reaching more and more into rather obscure internal APIs.
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.
❯./python -mtest -R 3:3 test_ctypesUsing random seed: 42114063800:00:00 load avg: 0.24 Run 1 test sequentially in a single process0:00:00 load avg: 0.24 [1/1] test_ctypesbeginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)123:456XX. .1.test_ctypes leaked [0, 1, 0] memory blocks, sum=1 (this is fine)0:00:15 load avg: 0.41 [1/1] test_ctypes passed== Tests result: SUCCESS ==1 test OK.Total duration: 15.4 secTotal tests: run=600 skipped=34Total test files: run=1/1Result: SUCCESS No refleaks |
Performance on this PR release build without pgo: ./python.bat client.pyRunning Release|x64 interpreter...0Connected.207440203568203348200588204112 |
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.
LGTM. Let's run the FT buildbots just in case.
Misc/NEWS.d/next/Library/2025-05-26-17-06-40.gh-issue-134637.9-3zRL.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
!buildbot nogil |
bedevere-bot commentedMay 26, 2025
🤖 New build scheduled with the buildbot fleet by@ZeroIntensity for commit095e1cb 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134702%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
…-3zRL.rstCo-authored-by: Peter Bierma <zintensitydev@gmail.com>
3c05251
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…ion pointer in `free threading`. (pythonGH-134702)Fix performance regression in calling `ctypes` function pointer in `free threading`.(cherry picked from commit3c05251)Co-authored-by: Kumar Aditya <kumaraditya@python.org>
GH-134742 is a backport of this pull request to the3.14 branch. |
…tion pointer in `free threading`. (GH-134702) (#134742)gh-134637: Fix performance regression in calling `ctypes` function pointer in `free threading`. (GH-134702)Fix performance regression in calling `ctypes` function pointer in `free threading`.(cherry picked from commit3c05251)Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Uh oh!
There was an error while loading.Please reload this page.
This fixes the performance regression mentioned on the issue, it avoids acquiring the critical section in the general case of no contention.