[issue32005] mutliprocessing.Array misleading error message in slice assignment

Steven D'Aprano report at bugs.python.org
Fri Nov 10 18:53:08 EST 2017


New submission from Steven D'Aprano <steve+python at pearwood.info>:

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

----------
components: Library (Lib)
messages: 306066
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: mutliprocessing.Array misleading error message in slice assignment
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32005>
_______________________________________


More information about the Python-bugs-list mailing list