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
Warning of deprecated fork are suppressed in more tests.
  • Loading branch information
rani-pinchuk committed Jul 20, 2025
commit d5336dc0109bfd53809271d9a4c0a46060ebf8af
18 changes: 18 additions & 0 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ def _test_put(cls, queue, child_can_start, parent_can_continue):
queue.get()
parent_can_continue.set()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_put(self):
MAXSIZE = 6
queue = self.Queue(maxsize=MAXSIZE)
Expand Down Expand Up @@ -1187,6 +1188,7 @@ def _test_get(cls, queue, child_can_start, parent_can_continue):
queue.put(5)
parent_can_continue.set()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_get(self):
queue = self.Queue()
child_can_start = self.Event()
Expand Down Expand Up @@ -1248,6 +1250,7 @@ def _test_fork(cls, queue):
# process cannot shutdown until the feeder thread has finished
# pushing items onto the pipe.

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_fork(self):
# Old versions of Queue would fail to create a new feeder
# thread for a forked process if the original process had its
Expand Down Expand Up @@ -1298,6 +1301,7 @@ def _test_task_done(cls, q):
time.sleep(DELTA)
q.task_done()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_task_done(self):
queue = self.JoinableQueue()

Expand Down Expand Up @@ -2912,6 +2916,7 @@ def test_async(self):
self.assertEqual(get(), 49)
self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_async_timeout(self):
p = self.Pool(3)
try:
Expand Down Expand Up @@ -3009,6 +3014,7 @@ def test_imap_unordered_handle_iterable_exception(self):
self.assertIn(value, expected_values)
expected_values.remove(value)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_make_pool(self):
expected_error = (RemoteError if self.TYPE == 'manager'
else ValueError)
Expand All @@ -3024,6 +3030,7 @@ def test_make_pool(self):
p.close()
p.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_terminate(self):
# Simulate slow tasks which take "forever" to complete
sleep_time = support.LONG_TIMEOUT
Expand All @@ -3041,6 +3048,7 @@ def test_terminate(self):
p.terminate()
p.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_empty_iterable(self):
# See Issue 12157
p = self.Pool(1)
Expand All @@ -3053,6 +3061,7 @@ def test_empty_iterable(self):
p.close()
p.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_context(self):
if self.TYPE == 'processes':
L = list(range(10))
Expand All @@ -3067,6 +3076,7 @@ def test_context(self):
def _test_traceback(cls):
raise RuntimeError(123) # some comment

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_traceback(self):
# We want ensure that the traceback from the child process is
# contained in the traceback raised in the main process.
Expand Down Expand Up @@ -3106,16 +3116,19 @@ def test_traceback(self):
p.join()

@classmethod
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def _test_wrapped_exception(cls):
raise RuntimeError('foo')

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_wrapped_exception(self):
# Issue #20980: Should not wrap exception when using thread pool
with self.Pool(1) as p:
with self.assertRaises(RuntimeError):
p.apply(self._test_wrapped_exception)
p.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_map_no_failfast(self):
# Issue #23992: the fail-fast behaviour when an exception is raised
# during map() would make Pool.join() deadlock, because a worker
Expand Down Expand Up @@ -3151,6 +3164,7 @@ def test_release_task_refs(self):
# they were released too.
self.assertEqual(CountedObject.n_instances, 0)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_enter(self):
if self.TYPE == 'manager':
self.skipTest("test not applicable to manager")
Expand All @@ -3167,6 +3181,7 @@ def test_enter(self):
pass
pool.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_resource_warning(self):
if self.TYPE == 'manager':
self.skipTest("test not applicable to manager")
Expand Down Expand Up @@ -3232,6 +3247,7 @@ def errback(exc):
class _TestPoolWorkerLifetime(BaseTestCase):
ALLOWED_TYPES = ('processes', )

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_pool_worker_lifetime(self):
p = multiprocessing.Pool(3, maxtasksperchild=10)
self.assertEqual(3, len(p._pool))
Expand Down Expand Up @@ -3261,6 +3277,7 @@ def test_pool_worker_lifetime(self):
p.close()
p.join()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_pool_worker_lifetime_early_close(self):
# Issue #10332: closing a pool whose workers have limited lifetimes
# before all the tasks completed would make join() hang.
Expand Down Expand Up @@ -4048,6 +4065,7 @@ def _remote(cls, conn):

conn.close()

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_pickling(self):
families = self.connection.families

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