summaryrefslogtreecommitdiffstats
path: root/Doc/library/multiprocessing.shared_memory.rst
diff options
context:
space:
mode:
authorPierre Glaser <pierreglaser@msn.com>2019-03-26 19:12:26 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-03-26 19:12:26 (GMT)
commit3b7e47aea9b29f2669e7178a461426d18bce349e (patch)
treec1fef6c501c16a218cc16df0f557ed06e48c6c99 /Doc/library/multiprocessing.shared_memory.rst
parentf8ba6f5afc317d1be3025db1be410ac66a7e5a27 (diff)
downloadcpython-3b7e47aea9b29f2669e7178a461426d18bce349e.zip
cpython-3b7e47aea9b29f2669e7178a461426d18bce349e.tar.gz
cpython-3b7e47aea9b29f2669e7178a461426d18bce349e.tar.bz2
bpo-36364: fix SharedMemoryManager examples (GH-12439)
Examples of the `multiprocessing.shared_memory` module try to import `SharedMemoryManager` from `multiprocessing.shared_memory` whereas this class is defined in `multiprocessing.managers`.
Diffstat (limited to 'Doc/library/multiprocessing.shared_memory.rst')
-rw-r--r--Doc/library/multiprocessing.shared_memory.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/multiprocessing.shared_memory.rst b/Doc/library/multiprocessing.shared_memory.rst
index 426fef6..cba576a 100644
--- a/Doc/library/multiprocessing.shared_memory.rst
+++ b/Doc/library/multiprocessing.shared_memory.rst
@@ -176,6 +176,7 @@ same ``numpy.ndarray`` from two distinct Python shells:
.. class:: SharedMemoryManager([address[, authkey]])
+ :module: multiprocessing.managers
A subclass of :class:`~multiprocessing.managers.BaseManager` which can be
used for the management of shared memory blocks across processes.
@@ -218,8 +219,8 @@ The following example demonstrates the basic mechanisms of a
.. doctest::
:options: +SKIP
- >>> from multiprocessing import shared_memory
- >>> smm = shared_memory.SharedMemoryManager()
+ >>> from multiprocessing.managers import SharedMemoryManager
+ >>> smm = SharedMemoryManager()
>>> smm.start() # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
@@ -238,7 +239,7 @@ needed:
.. doctest::
:options: +SKIP
- >>> with shared_memory.SharedMemoryManager() as smm:
+ >>> with SharedMemoryManager() as smm:
... sl = smm.ShareableList(range(2000))
... # Divide the work among two processes, storing partial results in sl
... p1 = Process(target=do_work, args=(sl, 0, 1000))