-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5a74e0e
gh-116738: Make grp module thread-safe
yoney 63360a0
gh-116738: Protect non thread-safe functions in default build
yoney c6861c6
gh-116738: Fix pre-processor block
yoney e879eed
gh-116738: Move run_concurrently() to threading_helper
yoney 851caf4
gh-116738: Improve run_concurrently() arguments
yoney f51d0d9
gh-116738: Consolidate group function calls under one mutex
yoney 5213757
Merge branch 'main' into ft_grpmodule_2
yoney 79028c8
gh-116738: Add global mutex variable to lint ignore list
yoney 6856752
gh-116738: Convert generator to list comprehension
yoney ed89087
Update Misc/NEWS.d/next/Core_and_Builtins/2025-06-12-00-03-34.gh-issu…
kumaraditya303 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import unittest | ||
|
||
from test.support import import_helper, threading_helper | ||
from test.support.threading_helper import run_concurrently | ||
|
||
grp = import_helper.import_module("grp") | ||
|
||
from test import test_grp | ||
|
||
|
||
NTHREADS = 10 | ||
|
||
|
||
@threading_helper.requires_working_threading() | ||
class TestGrp(unittest.TestCase): | ||
def setUp(self): | ||
self.test_grp = test_grp.GroupDatabaseTestCase() | ||
|
||
def test_racing_test_values(self): | ||
# test_grp.test_values() calls grp.getgrall() and checks the entries | ||
run_concurrently( | ||
worker_func=self.test_grp.test_values, nthreads=NTHREADS | ||
) | ||
|
||
def test_racing_test_values_extended(self): | ||
# test_grp.test_values_extended() calls grp.getgrall(), grp.getgrgid(), | ||
# grp.getgrnam() and checks the entries | ||
run_concurrently( | ||
worker_func=self.test_grp.test_values_extended, | ||
nthreads=NTHREADS, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Core_and_Builtins/2025-06-12-00-03-34.gh-issue-116738.iBBAdo.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Make methods in :mod:`grp` thread-safe on the :term:`free threaded <free threading>` build. | ||
kumaraditya303 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.