diff options
author | Gregory P. Smith <greg@krypto.org> | 2023-02-03 23:20:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-03 23:20:46 (GMT) |
commit | d4c410f0f922683f38c9d435923939d037fbd8c2 (patch) | |
tree | b776e07cb59767c41176c73e568a11d4957f2e51 /Lib/multiprocessing | |
parent | f6c53b80a16f63825479c5ca0f8a5e2829c3f505 (diff) | |
download | cpython-d4c410f0f922683f38c9d435923939d037fbd8c2.zip cpython-d4c410f0f922683f38c9d435923939d037fbd8c2.tar.gz cpython-d4c410f0f922683f38c9d435923939d037fbd8c2.tar.bz2 |
gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551)
This reverts the core of #100618 while leaving relevant documentation
improvements and minor refactorings in place.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/context.py | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 010a920..de8a264 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -23,9 +23,6 @@ class TimeoutError(ProcessError): class AuthenticationError(ProcessError): pass -class DefaultForkDeprecationWarning(DeprecationWarning): - pass - # # Base type for contexts. Bound methods of an instance of this type are included in __all__ of __init__.py # @@ -284,23 +281,6 @@ if sys.platform != 'win32': from .popen_fork import Popen return Popen(process_obj) - _warn_package_prefixes = (os.path.dirname(__file__),) - - class _DeprecatedForkProcess(ForkProcess): - @classmethod - def _Popen(cls, process_obj): - import warnings - warnings.warn( - "The default multiprocessing start method will change " - "away from 'fork' in Python >= 3.14, per GH-84559. " - "Use multiprocessing.get_context(X) or .set_start_method(X) to " - "explicitly specify it when your application requires 'fork'. " - "The safest start method is 'spawn'.", - category=DefaultForkDeprecationWarning, - skip_file_prefixes=_warn_package_prefixes, - ) - return super()._Popen(process_obj) - class SpawnProcess(process.BaseProcess): _start_method = 'spawn' @staticmethod @@ -324,9 +304,6 @@ if sys.platform != 'win32': _name = 'fork' Process = ForkProcess - class _DefaultForkContext(ForkContext): - Process = _DeprecatedForkProcess - class SpawnContext(BaseContext): _name = 'spawn' Process = SpawnProcess @@ -342,16 +319,13 @@ if sys.platform != 'win32': 'fork': ForkContext(), 'spawn': SpawnContext(), 'forkserver': ForkServerContext(), - # Remove None and _DefaultForkContext() when changing the default - # in 3.14 for https://github.com/python/cpython/issues/84559. - None: _DefaultForkContext(), } if sys.platform == 'darwin': # bpo-33725: running arbitrary code after fork() is no longer reliable # on macOS since macOS 10.14 (Mojave). Use spawn by default instead. _default_context = DefaultContext(_concrete_contexts['spawn']) else: - _default_context = DefaultContext(_concrete_contexts[None]) + _default_context = DefaultContext(_concrete_contexts['fork']) else: |