[issue39610] memoryview.__len__ should raise an exception for 0d buffers

Serhiy Storchaka report at bugs.python.org
Mon Sep 7 12:25:54 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

But iterating it raises different type of exception, wish obscure message.

>>> import ctypes
>>> mem_0d = memoryview(ctypes.c_uint8(42))
>>> list(mem_0d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format <B

Should not '<B' and be equivalent to '>B' and just 'B'? Would not adding support of formats with specified endianess make 0-dimensional memoryview objects iterable?

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list