Skip to content

Commit 27108e2

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

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

Doc/library/multiprocessing.rst

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

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

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

1055-
If *method* is ``None``, then the default context is returned.
1056-
This method sets the default context globally, which may affect
1057-
future usage of :func:`set_start_method`. If you wish to change the
1058-
method later, it is recommended to explicitly specify a method other
1059-
than ``None`` when calling this function. Otherwise, unexpected behavior
1060-
may occur.
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.
10611055

1062-
*method* should be one of the following:
1063-
``'fork'``, ``'spawn'``, or ``'forkserver'``.
1064-
:exc:`ValueError` is raised if the specified start
1065-
method is not available. See :ref:`multiprocessing-start-methods`.
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`.
10661057

10671058
.. versionadded:: 3.4
10681059

10691060
.. function:: get_start_method(allow_none=False)
10701061

1071-
Return the name of the start method used for starting processes.
1062+
Return the name of the start method used for initiating processes.
10721063

1073-
If the start method has not been explicitly set
1074-
(e.g., using :func:`set_start_method`) and *allow_none* is false,
1075-
then the start method is fixed to the default and the name of the
1076-
default method is returned. If the start method has not been explicitly
1077-
set and *allow_none* is true, then ``None`` is returned, indicating that
1078-
the method has not been explicitly set.
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.
10791065

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

1083-
.. note:: Changing the start method using ``multiprocessing.set_start_method``
1084-
after using ``multiprocessing.get_start_method`` with *allow_none* set to ``False``
1085-
may raise a ``RuntimeError``. Be cautious when changing the start method
1086-
after it has been set.
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``.
10871069

1088-
See
1089-
:ref:`multiprocessing-start-methods` for more information on multiprocessing start
1090-
methods and their implications.
1070+
See :ref:`multiprocessing-start-methods` for more information on multiprocessing start methods and their implications.
10911071

10921072
.. versionchanged:: 3.8
10931073

0 commit comments

Comments
 (0)