Open e26428b1-70cf-4e9f-ae3c-9ef0478633fb opened 12 years ago
The attached patch enables creation of shared objects allocated from shared memory using memoryview objects instead of ctypes.
This enables the use of shared memory on systems where ctypes is unavailable.
The new functions/classes RawArray, RawValue, Array and Array have been added to multiprocessing.heap. They are almost equivalent to the functions/classes of the same name in multiprocessing and multiprocessing.sharedctypes when a letter typecode is used (rather than a ctypes type).
The differences in behaviour are due to the differences between memoryview objects and ctypes arrays. The most noticeable is the fact that you can't set a slice using an arbitrary sequence, so
arr = multiprocessing.RawArray('i', [0]*10)
arr[:3] = [1,2,3]
has to be rewritten to something like
arr = multiprocessing.heap.RawArray('i', [0]*10)
arr[:3] = array.array('i', [1,2,3])
(No documetation yet.)
@Richard I assume that you'll be following this up.
Updated version of the patch. Still needs docs.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['type-feature']
title = 'Reimplement subset of multiprocessing.sharedctypes using memoryview'
updated_at =
user = 'https://bugs.python.org/sbt'
```
bugs.python.org fields:
```python
activity =
actor = 'BreamoreBoy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation =
creator = 'sbt'
dependencies = []
files = ['25754', '35902']
hgrepos = []
issue_num = 14953
keywords = ['patch']
message_count = 3.0
messages = ['161892', '222133', '222567']
nosy_count = 4.0
nosy_names = ['pitrou', 'neologix', 'sbt', 'davin']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue14953'
versions = ['Python 3.5']
```