Skip to content

Commit 6efbf9e

Browse files
committed
Update multiprocessing.rst
1 parent 27108e2 commit 6efbf9e

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

Doc/library/multiprocessing.rst

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,25 +1049,43 @@ Miscellaneous
10491049

10501050
.. function:: get_context(method=None)
10511051

1052-
Return a context object with the same attributes as the :mod:`multiprocessing` module.
1052+
Return a context object with the same attributes as the
1053+
:mod:`multiprocessing` module.
10531054

1054-
If *method* is ``None``, the default context is returned. Be aware that calling this function with *method=None* sets the default context globally, potentially affecting future usage of :func:`set_start_method`. To change the method later, it is recommended to explicitly specify a method other than ``None`` when calling this function. Otherwise, it may lead to unexpected behavior.
1055+
If *method* is ``None``, the default context is returned. Be aware that
1056+
calling this function with *method=None* sets the default context globally,
1057+
potentially affecting future usage of :func:`set_start_method`. To change
1058+
the method later, it is recommended to explicitly specify a method other
1059+
than ``None`` when calling this function. Otherwise, it may lead to
1060+
unexpected behavior.
10551061

1056-
*method* should be one of the following: ``'fork'``, ``'spawn'``, or ``'forkserver'``. A :exc:`ValueError` is raised if the specified start method is unavailable. See :ref:`multiprocessing-start-methods`.
1062+
*method* should be one of the following: ``'fork'``, ``'spawn'``, or
1063+
``'forkserver'``. A :exc:`ValueError` is raised if the specified start
1064+
method is unavailable. See :ref:`multiprocessing-start-methods`.
10571065

10581066
.. versionadded:: 3.4
10591067

10601068
.. function:: get_start_method(allow_none=False)
10611069

1062-
Return the name of the start method used for initiating processes.
1070+
Return the name of start method used for starting processes.
10631071

1064-
If the start method has not been explicitly set (e.g., using :func:`set_start_method`) and *allow_none* is false, then the start method is fixed to the default, and the name of the default method is returned. If the start method has not been explicitly set and *allow_none* is true, then ``None`` is returned, indicating that the method has not been explicitly set.
1072+
If the start method has not been explicitly set
1073+
(e.g., using :func:`set_start_method`) and *allow_none* is false, then the
1074+
start method is fixed to the default, and the name of the default method
1075+
is returned. If the start method has not been explicitly set and
1076+
*allow_none* is true, then ``None`` is returned, indicating that
1077+
the method has not been explicitly set.
10651078

1066-
The return value can be one of the following: ``'fork'``, ``'spawn'``, ``'forkserver'``, or ``None``.
1079+
The return value can be one of the following: ``'fork'``, ``'spawn'``,
1080+
``'forkserver'``, or ``None``.
10671081

1068-
.. note:: Exercise caution when changing the start method using ``multiprocessing.set_start_method`` after using ``multiprocessing.get_start_method`` with *allow_none* set to ``False``, as it may raise a ``RuntimeError``.
1082+
.. note:: Exercise caution when changing the start method using
1083+
``multiprocessing.set_start_method`` after using
1084+
``multiprocessing.get_start_method`` with *allow_none* set to
1085+
``False``, as it may raise a ``RuntimeError``.
10691086

1070-
See :ref:`multiprocessing-start-methods` for more information on multiprocessing start methods and their implications.
1087+
See :ref:`multiprocessing-start-methods` for more information
1088+
on multiprocessing start methods and their implications.
10711089

10721090
.. versionchanged:: 3.8
10731091

0 commit comments

Comments
 (0)