This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing.Array misleading error message in slice assignment
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
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 2022-04-11 14:58 by admin.

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
2022-04-11 14:58:54adminsetgithub: 76186
2021-06-22 11:57:27iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.5
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