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.

Author hct
Recipients hct, skrah
Date 2013-11-27.21:09:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385586585.33.0.640639870537.issue19803@psf.upfronthosting.co.za>
In-reply-to
Content
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 '@'
>>>
History
Date User Action Args
2013-11-27 21:09:45hctsetrecipients: + hct, skrah
2013-11-27 21:09:45hctsetmessageid: <1385586585.33.0.640639870537.issue19803@psf.upfronthosting.co.za>
2013-11-27 21:09:45hctlinkissue19803 messages
2013-11-27 21:09:44hctcreate