Visitar URL original
GH-84559: Deprecate fork being the multiprocessing default. by gpshead · Pull Request #100618 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
avoid DeprecationWarnings vs -Werror
  • Loading branch information
gpshead committed Dec 31, 2022
commit a1064dee146334e77641a39fa6cb3b868badd15f
1 change: 1 addition & 0 deletions Lib/test/_test_venv_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def test_func():


def main():
multiprocessing.set_start_method('spawn')
test_pool = multiprocessing.Process(target=test_func)
test_pool.start()
test_pool.join()
Expand Down
9 changes: 8 additions & 1 deletion Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import concurrent.futures
import functools
import io
import multiprocessing
import os
import platform
import re
Expand Down Expand Up @@ -2696,7 +2697,13 @@ def test_get_event_loop_new_process(self):
support.skip_if_broken_multiprocessing_synchronize()

async def main():
pool = concurrent.futures.ProcessPoolExecutor()
if multiprocessing.get_start_method() == 'fork':
# Avoid 'fork' DeprecationWarning.
mp_context = multiprocessing.get_context('forkserver')
else:
mp_context = None
pool = concurrent.futures.ProcessPoolExecutor(
mp_context=mp_context)
result = await self.loop.run_in_executor(
pool, _test_get_event_loop_new_process__sub_proc)
pool.shutdown()
Expand Down