GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-116738: Make grp module thread-safe by yoney · Pull Request #135434 · python/cpython

Conversation

@yoney

@yoney yoney commented Jun 12, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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

  • Issue: Audit all built-in modules for thread safety #116738

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot mentioned this pull request Jun 12, 2025
Audit all built-in modules for thread safety #116738
Open
@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
@bedevere-app bedevere-app Bot added the awaiting review label Jun 12, 2025
@yoney

yoney commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity ZeroIntensity added the topic-free-threading label Jun 13, 2025
@colesbury
colesbury requested review from Yhg1s, colesbury and mpage June 16, 2025 17:15
colesbury
colesbury reviewed Jun 16, 2025
View reviewed changes
Comment thread Modules/grpmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/grpmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

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

bedevere-bot commented Jun 16, 2025

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
ZeroIntensity
ZeroIntensity reviewed Jun 16, 2025
View reviewed changes
Comment thread Lib/test/test_free_threading/test_ft.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rhettinger
rhettinger removed their request for review June 17, 2025 02:52
@mpage

mpage commented Jun 26, 2025

Copy link
Copy Markdown
Contributor

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

yoney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

yoney added 4 commits June 26, 2025 11:22
@yoney
pythongh-116738: Make grp module thread-safe
5a74e0e
@yoney
pythongh-116738: Protect non thread-safe functions in default build
63360a0
@yoney
pythongh-116738: Fix pre-processor block
c6861c6
@yoney
pythongh-116738: Move run_concurrently() to threading_helper
e879eed
@yoney
yoney force-pushed the ft_grpmodule_2 branch from dedbae9 to e879eed Compare June 26, 2025 19:46
@yoney

yoney commented Jun 26, 2025

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mpage

mpage commented Jun 26, 2025

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ZeroIntensity
ZeroIntensity reviewed Jun 30, 2025
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/support/threading_helper.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303
kumaraditya303 reviewed Jul 3, 2025
View reviewed changes
Comment thread Modules/grpmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

yoney added 4 commits July 3, 2025 13:05
@yoney
pythongh-116738: Improve run_concurrently() arguments
851caf4
@yoney
pythongh-116738: Consolidate group function calls under one mutex
f51d0d9
@yoney
Merge branch 'main' into ft_grpmodule_2
5213757
@yoney
pythongh-116738: Add global mutex variable to lint ignore list
79028c8
@yoney
yoney requested a review from ericsnowcurrently as a code owner July 9, 2025 17:19
kumaraditya303
kumaraditya303 reviewed Jul 11, 2025
View reviewed changes
Comment thread Lib/test/support/threading_helper.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@yoney
pythongh-116738: Convert generator to list comprehension
6856752
kumaraditya303
kumaraditya303 reviewed Jul 12, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Core_and_Builtins/2025-06-12-00-03-34.gh-issue-116738.iBBAdo.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
Update Misc/NEWS.d/next/Core_and_Builtins/2025-06-12-00-03-34.gh-issu…
ed89087
…e-116738.iBBAdo.rst
kumaraditya303
kumaraditya303 approved these changes Jul 13, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jul 13, 2025
@yoney

yoney commented Jul 14, 2025

Copy link
Copy Markdown
Contributor Author

@kumaraditya303 Thank you for the review!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mpage
mpage approved these changes Jul 14, 2025
View reviewed changes
mpage
mpage approved these changes Jul 14, 2025
View reviewed changes
@mpage
mpage merged commit 9363703 into python:main Jul 14, 2025
@miss-islington-app

miss-islington-app Bot commented Jul 14, 2025

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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jul 14, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 14, 2025
@yoney @kumaraditya303 @miss-islington
pythongh-116738: Make grp module thread-safe (pythonGH-135434)
6e39a40
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 <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
@bedevere-app

bedevere-app Bot commented Jul 14, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot 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
@miss-islington @yoney @kumaraditya303
[3.14] gh-116738: Make grp module thread-safe (GH-135434) (#136658)
55eaaab
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 <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
@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
@yoney @kumaraditya303 @taegyunkim
pythongh-116738: Make grp module thread-safe (python#135434)
c698b8d
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 <[email protected]>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@yoney @kumaraditya303 @Agent-Hellboy
pythongh-116738: Make grp module thread-safe (python#135434)
33afbe0
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 <[email protected]>
kumaraditya303 added a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
@miss-islington @yoney @kumaraditya303
[3.14] pythongh-116738: Make grp module thread-safe (pythonGH-135434) (…
de7e2f7
…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 <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colesbury colesbury colesbury left review comments
@ZeroIntensity ZeroIntensity ZeroIntensity left review comments
@mpage mpage mpage approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@Yhg1s Yhg1s Awaiting requested review from Yhg1s
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@yoney @bedevere-bot @mpage @colesbury @ZeroIntensity @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.