gh-84559: Remove the new multiprocessing warning, too disruptive. by gpshead · Pull Request #101551 · python/cpython
class DefaultForkDeprecationWarning(DeprecationWarning): pass
# # Base type for contexts. Bound methods of an instance of this type are included in __all__ of __init__.py #
_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
class _DefaultForkContext(ForkContext): Process = _DeprecatedForkProcess
class SpawnContext(BaseContext): _name = 'spawn' Process = SpawnProcess
else: