Skip to content

gh-116738: Make grp module thread-safe #135434

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

yoney
Copy link
Contributor

@yoney yoney commented Jun 12, 2025

Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.

  • Introduce Lib/test/test_free_threading/test_ft.py to reuse run_concurrently() across multiple tests.

cc: @mpage @colesbury @Yhg1s

@yoney yoney marked this pull request as ready for review June 12, 2025 16:01
@yoney yoney requested a review from rhettinger as a code owner June 12, 2025 16:01
@yoney
Copy link
Contributor Author

yoney commented Jun 12, 2025

Note: I am not sure if there is a CI setup where getgrgid_r()/getgrnam_r() are not available. I tested those manually on my local machine.

@colesbury colesbury added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 16, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 269b454 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F135434%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 16, 2025
@colesbury colesbury added the needs backport to 3.14 bugs and security fixes label Jun 16, 2025
from test.support import threading_helper


def run_concurrently(worker_func, args, nthreads):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like something that would fit better in test.support.threading_helper.

@rhettinger rhettinger removed their request for review June 17, 2025 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants