Skip to content

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

Merged
mpage merged 10 commits into
python:mainfrom
yoney:ft_grpmodule_2
Jul 14, 2025
Merged

gh-116738: Make grp module thread-safe#135434
mpage merged 10 commits into
python:mainfrom
yoney:ft_grpmodule_2

Conversation

@yoney

@yoneyyoney commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

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

  • Move run_concurrently() to test.support.threading_helper to resuse 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 ownerJune 12, 2025 16:01
@yoney

Copy link
Copy Markdown
ContributorAuthor

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.

Comment threadModules/grpmodule.c Outdated
Comment threadModules/grpmodule.c Outdated
@colesburycolesbury added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 16, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 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-botbedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 16, 2025
@colesburycolesbury added the needs backport to 3.14 bugs and security fixes label Jun 16, 2025
Comment threadLib/test/test_free_threading/test_ft.py Outdated
@rhettinger
rhettinger removed their request for review June 17, 2025 02:52
@mpage

Copy link
Copy Markdown
Contributor

@yoney - Can you merge main and fix up the conflicts?

@yoney

Copy link
Copy Markdown
ContributorAuthor

@yoney - Can you merge main and fix up the conflicts?

I rebased and force push but I think this is not the right way, I should have merged the main on top of my branch, I am sorry.

@mpage

Copy link
Copy Markdown
Contributor

I rebased and force push but I think this is not the right way, I should have merged the main on top of my branch, I am sorry.

No worries!

@ZeroIntensityZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The core changes look good to me, just a few comments about the new threading_helper function.

Comment threadLib/test/support/threading_helper.py Outdated
Comment threadModules/grpmodule.c Outdated
Comment threadLib/test/support/threading_helper.py Outdated
@yoney

Copy link
Copy Markdown
ContributorAuthor

@kumaraditya303 Thank you for the review!

@mpage
mpage merged commit 9363703 into python:mainJul 14, 2025
45 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @yoney for the PR, and @mpage for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 14, 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.
---------
(cherry picked from commit 9363703)
Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app

Copy link
Copy Markdown

GH-136658 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Jul 14, 2025
kumaraditya303 added a commit that referenced this pull request Jul 15, 2025
gh-116738: Make grp module thread-safe (GH-135434)
Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------
(cherry picked from commit 9363703)
Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@yoney
yoney deleted the ft_grpmodule_2 branch July 15, 2025 17:26
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 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.
---------
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 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.
---------
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
kumaraditya303 added a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…python#136658)
pythongh-116738: Make grp module thread-safe (pythonGH-135434)
Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------
(cherry picked from commit 9363703)
Co-authored-by: Alper <alperyoney@fb.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@yoney@bedevere-bot@mpage@colesbury@ZeroIntensity@kumaraditya303