Message204614
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 '@'
>>> |
|
Date |
User |
Action |
Args |
2013-11-27 21:12:36 | hct | set | recipients:
+ hct, skrah |
2013-11-27 21:12:36 | hct | set | messageid: <1385586756.73.0.494348614534.issue19803@psf.upfronthosting.co.za> |
2013-11-27 21:12:36 | hct | link | issue19803 messages |
2013-11-27 21:12:36 | hct | create | |
|