classification
Title: multiprocessing.Array misleading error message in slice assignment
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: steven.daprano
Priority: normal Keywords:

Created on 2017-11-10 23:53 by steven.daprano, last changed 2017-11-11 00:04 by steven.daprano.

Messages (1)
msg306066 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2017-11-10 23:53
multiprocessing.Array slice assignment claims to require a single character even if it requires more than one:

py> arr = multiprocessing.Array('c', 3)
py> arr[:] = b'xyz'  # works
py> arr[:] = 'xyz'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/multiprocessing/sharedctypes.py", line 226, in __setitem__
    self._obj[i] = value
TypeError: one character bytes, bytearray or integer expected
History
Date User Action Args
2017-11-11 00:04:22steven.dapranosettitle: mutliprocessing.Array misleading error message in slice assignment -> multiprocessing.Array misleading error message in slice assignment
2017-11-10 23:53:08steven.dapranocreate