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

Merged
kumaraditya303 merged 6 commits intopython:mainfromkumaraditya303:ctypes
May 26, 2025

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303kumaraditya303 commentedMay 26, 2025
edited by bedevere-appbot
Loading

This fixes the performance regression mentioned on the issue, it avoids acquiring the critical section in the general case of no contention.

@ZeroIntensityZeroIntensity self-requested a reviewMay 26, 2025 13:56
Copy link
Member

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

@kumaraditya303kumaraditya303 added the needs backport to 3.14bugs and security fixes labelMay 26, 2025
@kumaraditya303
Copy link
ContributorAuthor

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

@kumaraditya303
Copy link
ContributorAuthor

Performance on this PR release build without pgo:

 ./python.bat client.pyRunning Release|x64 interpreter...0Connected.207440203568203348200588204112
ZeroIntensity reacted with hooray emoji

Copy link
Member

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

@ZeroIntensity
Copy link
Member

!buildbot nogil

@bedevere-bot
Copy link

🤖 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:nogil

The builders matched are:

  • aarch64 Fedora Rawhide NoGIL refleaks PR
  • PPC64LE Fedora Rawhide NoGIL PR
  • AMD64 Windows PGO NoGIL PR
  • AMD64 Windows Server 2022 NoGIL PR
  • ARM64 MacOS M1 NoGIL PR
  • s390x Fedora Rawhide NoGIL PR
  • AMD64 Fedora Rawhide NoGIL refleaks PR
  • aarch64 Fedora Rawhide NoGIL PR
  • PPC64LE Fedora Rawhide NoGIL refleaks PR
  • AMD64 Fedora Rawhide NoGIL PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • x86-64 MacOS Intel NoGIL PR
  • AMD64 CentOS9 NoGIL PR
  • s390x Fedora Rawhide NoGIL refleaks PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • AMD64 CentOS9 NoGIL Refleaks PR

…-3zRL.rstCo-authored-by: Peter Bierma <zintensitydev@gmail.com>
@kumaraditya303kumaraditya303enabled auto-merge (squash)May 26, 2025 17:49
@kumaraditya303kumaraditya303 linked an issueMay 26, 2025 that may beclosed by this pull request
@kumaraditya303kumaraditya303 merged commit3c05251 intopython:mainMay 26, 2025
39 checks passed
@miss-islington-app
Copy link

Thanks@kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@kumaraditya303kumaraditya303 deleted the ctypes branchMay 26, 2025 18:26
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 26, 2025
…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>
@bedevere-app
Copy link

GH-134742 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 26, 2025
kumaraditya303 added a commit that referenced this pull requestMay 26, 2025
…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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou left review comments

@ZeroIntensityZeroIntensityZeroIntensity approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3.14t vs 3.13t cuts IOCP performance in half
4 participants
@kumaraditya303@ZeroIntensity@bedevere-bot@encukou

[8]ページ先頭

©2009-2025 Movatter.jp