Skip to content

Commit 4ad605a

Browse files
committed
move back to a note, it keeps it clear that this is "special"
1 parent b9773c7 commit 4ad605a

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

Doc/library/multiprocessing.rst

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -548,33 +548,35 @@ The :mod:`multiprocessing` package mostly replicates the API of the
548548
base class constructor (:meth:`Process.__init__`) before doing anything else
549549
to the process.
550550

551-
In general, all arguments to :meth:`Process.__init__` must be picklable.
552-
This is particularly notable when trying to create a :class:`Process` or
553-
use a :class:`~concurrent.futures.ProcessPoolExecutor` from a REPL with a
554-
locally defined *target* function.
551+
.. note::
555552

556-
Passing a callable object defined in the current REPL session raises an
557-
:exc:`AttributeError` exception when starting the process as such as
558-
*target* must have been defined within an importable module to under to be
559-
unpickled.
553+
In general, all arguments to :meth:`Process.__init__` must be picklable.
554+
This is particularly notable when trying to create a :class:`Process` or use
555+
a :class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally
556+
defined *target* function.
560557

561-
Example::
558+
Passing a callable object defined in the current REPL session raises an
559+
:exc:`AttributeError` exception when starting the process as such as
560+
*target* must have been defined within an importable module to under to be
561+
unpickled.
562562

563-
>>> import multiprocessing as mp
564-
>>> def knigit():
565-
... print("knee!")
566-
...
567-
>>> mp.Process(target=knigit).start()
568-
>>> Traceback (most recent call last):
569-
File ".../multiprocessing/spawn.py", line ..., in spawn_main
570-
File ".../multiprocessing/spawn.py", line ..., in _main
571-
AttributeError: module '__main__' has no attribute 'knigit'
563+
Example::
564+
565+
>>> import multiprocessing as mp
566+
>>> def knigit():
567+
... print("knee!")
568+
...
569+
>>> mp.Process(target=knigit).start()
570+
>>> Traceback (most recent call last):
571+
File ".../multiprocessing/spawn.py", line ..., in spawn_main
572+
File ".../multiprocessing/spawn.py", line ..., in _main
573+
AttributeError: module '__main__' has no attribute 'knigit'
572574

573-
See :ref:`multiprocessing-programming-spawn`.
575+
See :ref:`multiprocessing-programming-spawn`.
574576

575-
While this restriction is not true if using the ``"fork"`` start method,
576-
as of Python ``3.14`` that is no longer the default on any platform. See
577-
:ref:`multiprocessing-start-methods`.
577+
While this restriction is not true if using the ``"fork"`` start method,
578+
as of Python ``3.14`` that is no longer the default on any platform. See
579+
:ref:`multiprocessing-start-methods`.
578580

579581
.. versionchanged:: 3.3
580582
Added the *daemon* parameter.

0 commit comments

Comments
 (0)