Make multiprocessing's shared memory use memoryview instead of raw pointer
diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py
index 311e402..4e93c12 100644
--- a/Lib/multiprocessing/heap.py
+++ b/Lib/multiprocessing/heap.py
@@ -205,7 +205,7 @@
self._lock.release()
#
-# Class representing a chunk of an mmap -- can be inherited
+# Class representing a chunk of an mmap -- can be inherited by child process
#
class BufferWrapper(object):
@@ -218,11 +218,6 @@
self._state = (block, size)
Finalize(self, BufferWrapper._heap.free, args=(block,))
- def get_address(self):
+ def create_memoryview(self):
(arena, start, stop), size = self._state
- address, length = _multiprocessing.address_of_buffer(arena.buffer)
- assert size <= length
- return address + start
-
- def get_size(self):
- return self._state[1]
+ return memoryview(arena.buffer)[start:start+size]