Skip to content

Commit 2a115a3

Browse files
committed
editing for clarity
1 parent 4ad605a commit 2a115a3

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

Doc/library/multiprocessing.rst

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -545,37 +545,39 @@ The :mod:`multiprocessing` package mostly replicates the API of the
545545
to pass to *target*.
546546

547547
If a subclass overrides the constructor, it must make sure it invokes the
548-
base class constructor (:meth:`Process.__init__`) before doing anything else
548+
base class constructor (``super().__init__()``) before doing anything else
549549
to the process.
550550

551551
.. note::
552552

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.
553+
In general, all arguments to :class:`Process` must be picklable. This is
554+
frequently observed when trying to create a :class:`Process` or use a
555+
:class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a
556+
locally defined *target* function.
557557

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.
558+
Passing a callable object defined in the current REPL session causes the
559+
child process to die via an uncaught :exc:`AttributeError` exception when
560+
starting as *target* must have been defined within an importable module
561+
in order to be loaded during unpickling.
562562

563-
Example::
563+
Example of this uncatchable error from the child::
564564

565565
>>> import multiprocessing as mp
566566
>>> def knigit():
567-
... print("knee!")
567+
... print("Ni!")
568568
...
569-
>>> mp.Process(target=knigit).start()
569+
>>> process = mp.Process(target=knigit)
570+
>>> process.start()
570571
>>> Traceback (most recent call last):
571572
File ".../multiprocessing/spawn.py", line ..., in spawn_main
572573
File ".../multiprocessing/spawn.py", line ..., in _main
573574
AttributeError: module '__main__' has no attribute 'knigit'
575+
>>> process
576+
<SpawnProcess name='SpawnProcess-1' pid=379473 parent=378707 stopped exitcode=1>
574577

575-
See :ref:`multiprocessing-programming-spawn`.
576-
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
578+
See :ref:`multiprocessing-programming-spawn`. While this restriction is
579+
not true if using the ``"fork"`` start method, as of Python ``3.14`` that
580+
is no longer the default on any platform. See
579581
:ref:`multiprocessing-start-methods`.
580582

581583
.. versionchanged:: 3.3
@@ -3107,7 +3109,7 @@ start method.
31073109

31083110
More picklability
31093111

3110-
Ensure that all arguments to :meth:`Process.__init__` are picklable.
3112+
Ensure that all arguments to :class:`Process` are picklable.
31113113
Also, if you subclass :class:`~multiprocessing.Process` then make sure that
31123114
instances will be picklable when the :meth:`Process.start
31133115
<multiprocessing.Process.start>` method is called.

0 commit comments

Comments
 (0)