Skip to content

gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror #136796

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 32 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6622c55
gh-135427: Fix DeprecationWarning for os.fork when run in threads wit…
rani-pinchuk Jul 19, 2025
7b13bdc
Merge branch 'main' into fix-issue-135427
rani-pinchuk Jul 19, 2025
bf97fe0
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 19, 2025
3482918
gh-135427: check that exception occured, and also clear later the exc…
rani-pinchuk Jul 19, 2025
ce90d77
Merge remote-tracking branch 'refs/remotes/origin/fix-issue-135427' i…
rani-pinchuk Jul 19, 2025
1a20748
Behavior changed to raise an exception when fork is used within a thr…
rani-pinchuk Jul 20, 2025
9bead0e
Seems like test_multiprocessing fork deprecation warnings are suppres…
rani-pinchuk Jul 20, 2025
d5336dc
Warning of deprecated fork are suppressed in more tests.
rani-pinchuk Jul 20, 2025
ae3a5ed
WIP - suppressing warnings in tests that fail in the tests running on…
rani-pinchuk Jul 20, 2025
f768f5d
WIP - continuing suppressing warnings in tests.
rani-pinchuk Jul 21, 2025
6308e19
WIP - fix imports.
rani-pinchuk Jul 21, 2025
8955136
WIP - more suppressing of warnings
rani-pinchuk Jul 21, 2025
8731cba
WIP - fix ignore_warnings to wrap also async functions
rani-pinchuk Jul 21, 2025
41e8337
WIP - more suppress of warnings.
rani-pinchuk Jul 21, 2025
359b0ed
WIP - more suppress of warnings.
rani-pinchuk Jul 21, 2025
5277d4c
WIP - test.test_multiprocessing_fork gives no errors on local ubuntu …
rani-pinchuk Jul 21, 2025
204c642
WIP - more suppression of warnings
rani-pinchuk Jul 22, 2025
1b44537
WIP - adding more suppressing of the DeprecatinoWarning
rani-pinchuk Jul 22, 2025
c43b3c0
WIP - more suppress of warnings.
rani-pinchuk Jul 22, 2025
5d7ae0c
Merge branch 'main' into fix-issue-135427
rani-pinchuk Jul 22, 2025
868ffd6
WIP - more suppress of warnings.
rani-pinchuk Jul 22, 2025
e1398d8
Add dedicated decorator to ignore only the fork in thread deprecation…
rani-pinchuk Jul 24, 2025
b58b2ca
Replace the generic decorators to ignore deprecation errors with spec…
rani-pinchuk Jul 24, 2025
8d832ac
Linting issue
rani-pinchuk Jul 24, 2025
a0fc743
Update Modules/posixmodule.c
rani-pinchuk Jul 31, 2025
5d1d553
Update Misc/NEWS.d/next/Library/2025-07-19-11-53-19.gh-issue-135427.i…
rani-pinchuk Jul 31, 2025
5a80e4a
Simply ignore_warning functions
rani-pinchuk Jul 31, 2025
52f6f97
Linting fix
rani-pinchuk Jul 31, 2025
36147a1
Remove Misc/mypy/_colorize.py - should be a symlink
rani-pinchuk Jul 31, 2025
baab332
Remove Misc/mypy/_token.py and Misc/mypy/_pyrelp - should be a symlink
rani-pinchuk Jul 31, 2025
244869e
Ignore the symlinked files
rani-pinchuk Jul 31, 2025
8b699d8
Fix warning for asymc function
rani-pinchuk Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Seems like test_multiprocessing fork deprecation warnings are suppres…
…sed.
  • Loading branch information
rani-pinchuk committed Jul 20, 2025
commit 9bead0e39d45d34117aaf8485472c7d82c943576
27 changes: 23 additions & 4 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,7 @@ def test_notify(self):
threading_helper.join_thread(t)
join_process(p)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_notify_all(self):
cond = self.Condition()
sleeping = self.Semaphore(0)
Expand Down Expand Up @@ -1834,6 +1835,7 @@ def test_notify_all(self):
# NOTE: join_process and join_thread are the same
threading_helper.join_thread(w)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_notify_n(self):
cond = self.Condition()
sleeping = self.Semaphore(0)
Expand Down Expand Up @@ -1974,6 +1976,7 @@ def _test_wait_result(cls, c, pid):
if pid is not None:
os.kill(pid, signal.SIGINT)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_wait_result(self):
if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
pid = os.getpid()
Expand Down Expand Up @@ -2801,8 +2804,16 @@ class _TestPool(BaseTestCase):

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.pool = cls.Pool(4)
# gh-135427
# In some of the tests, a forked child forks another child of itself. In that case, using
# warnings_helper.ignore_warnings decorator does not actually ignore the warning from that
# child of child, and a warnings_helper.ignore_warnings exception is raised.
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message=".*fork.*may lead to deadlocks in the child.*",
category=DeprecationWarning)
super().setUpClass()
cls.pool = cls.Pool(4)

@classmethod
def tearDownClass(cls):
Expand Down Expand Up @@ -6982,8 +6993,16 @@ def Pool(cls, *args, **kwds):

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.manager = multiprocessing.Manager()
# gh-135427
# In some of the tests, a forked child forks another child of itself. In that case, using
# warnings_helper.ignore_warnings decorator does not actually ignore the warning from that
# child of child, and a warnings_helper.ignore_warnings exception is raised.
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message=".*fork.*may lead to deadlocks in the child.*",
category=DeprecationWarning)
super().setUpClass()
cls.manager = multiprocessing.Manager()

@classmethod
def tearDownClass(cls):
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy