New submission from Alexander Belopolsky:

Starting with the example in memoryview documentation:

>>> from ctypes import BigEndianStructure, c_long
>>> class BEPoint(BigEndianStructure):
...     _fields_ = [("x", c_long), ("y", c_long)]
...
>>> point = BEPoint(100, 200)
>>> a = memoryview(point)

I am trying to unpack the resulting view:

>>> a.tolist()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotImplementedError: memoryview: unsupported format T{>l:x:>l:y:}

>>> struct.unpack_from(a.format,a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: bad char in struct format

>>> struct.unpack_from('>ll',a)
(0, 100)


It looks like there is one or more bugs in play here.

----------
messages: 169771
nosy: belopolsky, skrah
priority: normal
severity: normal
status: open
title: memoryview of a ctypes struct has incompatible invalid format
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to