Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Have all doctests use 'spawn'.
  • Loading branch information
gpshead committed Jan 1, 2023
commit f7e31618b7e469e3892b44af09cc97ca14619ff3
10 changes: 6 additions & 4 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,8 @@ The :mod:`multiprocessing` package mostly replicates the API of the
.. doctest::

>>> import multiprocessing, time, signal
>>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
>>> mp_context = multiprocessing.get_context('spawn')
>>> p = mp_context.Process(target=time.sleep, args=(1000,))
>>> print(p, p.is_alive())
<Process ... initial> False
>>> p.start()
Expand Down Expand Up @@ -1928,7 +1929,8 @@ their parent process exits. The manager classes are defined in the

.. doctest::

>>> manager = multiprocessing.Manager()
>>> mp_context = multiprocessing.get_context('spawn')
>>> manager = mp_context.Manager()
>>> Global = manager.Namespace()
>>> Global.x = 10
>>> Global.y = 'hello'
Expand Down Expand Up @@ -2040,8 +2042,8 @@ the proxy). In this way, a proxy can be used just like its referent can:

.. doctest::

>>> from multiprocessing import Manager
>>> manager = Manager()
>>> mp_context = multiprocessing.get_context('spawn')
>>> manager = mp_context.Manager()
>>> l = manager.list([i*i for i in range(10)])
>>> print(l)
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Expand Down