bpo-36364: fix SharedMemoryManager examples (GH-12439) · python/cpython@3b7e47a
@@ -176,6 +176,7 @@ same ``numpy.ndarray`` from two distinct Python shells:
176176177177178178.. class:: SharedMemoryManager([address[, authkey]])
179+:module: multiprocessing.managers
179180180181 A subclass of :class:`~multiprocessing.managers.BaseManager` which can be
181182 used for the management of shared memory blocks across processes.
@@ -218,8 +219,8 @@ The following example demonstrates the basic mechanisms of a
218219.. doctest::
219220:options: +SKIP
220221221->>> from multiprocessing import shared_memory
222->>> smm = shared_memory.SharedMemoryManager()
222+>>> from multiprocessing.managers import SharedMemoryManager
223+>>> smm = SharedMemoryManager()
223224>>> smm.start() # Start the process that manages the shared memory blocks
224225>>> sl = smm.ShareableList(range(4))
225226>>> sl
@@ -238,7 +239,7 @@ needed:
238239.. doctest::
239240:options: +SKIP
240241241->>> with shared_memory.SharedMemoryManager() as smm:
242+>>> with SharedMemoryManager() as smm:
242243 ... sl = smm.ShareableList(range(2000))
243244 ... # Divide the work among two processes, storing partial results in sl
244245 ... p1 = Process(target=do_work, args=(sl, 0, 1000))