HCT added the comment: this seems to disagree with the statement of "Memoryview currently only knows the types from the struct module."
why is memoryview aware of _pack_, a implementation detail of ctypes structures. is memoryview a collection of implementation for different types or a unique type on its own? >>> import ctypes >>> class B1(ctypes.Structure): ... _fields_ = [( "data", c_uint8 * 256 ), ] ... _pack_ = 1 ... >>> class B2(ctypes.Structure): ... _fields_ = [( "data", c_uint8 * 256 ), ] ... >>> >>> a = B1() >>> b = B2() >>> memoryview( a ).cast( 'B' ) <memory at 0x01FFCDC0> >>> memoryview( b ).cast( 'B' ) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: memoryview: source format must be a native single character format prefixed with an optional '@' >>> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19803> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com