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:12:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385586756.73.0.494348614534.issue19803@psf.upfronthosting.co.za>
In-reply-to
Content
more examples (using 64-bit integer vs 8-bit integer in the above example) to show that ctypes aren't being translated for memoryview properly. _pack_ is the only way to make memoryview handle ctypes properly


>>> import ctypes
>>> class B1(ctypes.Structure):
...     _fields_ = [( "data", ctypes.c_uint64 * 256 ), ]
...     _pack_ = 1
...
>>> class B2(ctypes.Structure):
...     _fields_ = [( "data", ctypes.c_uint64 * 256 ), ]
...
>>>
>>> a = B1()
>>> b = B2()
>>> memoryview( a ).cast( 'B' )
<memory at 0x01FFB030>
>>> 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:12:36hctsetrecipients: + hct, skrah
2013-11-27 21:12:36hctsetmessageid: <1385586756.73.0.494348614534.issue19803@psf.upfronthosting.co.za>
2013-11-27 21:12:36hctlinkissue19803 messages
2013-11-27 21:12:36hctcreate