[docs] [issue23756] Tighten definition of bytes-like objects

Stefan Krah report at bugs.python.org
Sat Aug 8 14:09:21 CEST 2015


Stefan Krah added the comment:

I would commit this, except that I'm not too happy with the use of
the term "bytes-like" in general. Yesterday I mistyped this:

>>> import ctypes
>>> x = ctypes.c_double
>>> m = memoryview(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: memoryview: a bytes-like object is required, not '_ctypes.PyCSimpleType'


The previous error message was (changed in #16518) was:

"_ctypes.PyCSimpleType does not support the buffer interface".


Which I find much clearer. Memoryviews (for better or worse,
but PEP-3118 was accepted) are Mini-NumPy-arrays. I'm still not
sure if we should hide that from users.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23756>
_______________________________________


More information about the docs mailing list