[New-bugs-announce] [issue10744] ctypes arrays have incorrect buffer information (PEP-3118)

Pauli Virtanen report at bugs.python.org
Mon Dec 20 23:06:48 CET 2010


New submission from Pauli Virtanen <pav at iki.fi>:

Ctypes arrays have invalid buffer interface information (on Python 3.1.2):

>>> import ctypes
>>> x = (ctypes.c_double*2)()
>>> y = memoryview(x)
>>> y.shape
(2,)
>>> y.format
'(2)<d'

This implies that the array contains 2 items, each consisting of 2 floats, which is incorrect -- the shape information is duplicated.

A suggested fix is attached.

(From http://projects.scipy.org/numpy/ticket/1699)

----------
assignee: theller
components: ctypes
files: 001-ctypes-fix-pep-3118-format-strings-for-arrays.patch
keywords: patch
messages: 124406
nosy: pv, theller
priority: normal
severity: normal
status: open
title: ctypes arrays have incorrect buffer information (PEP-3118)
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20123/001-ctypes-fix-pep-3118-format-strings-for-arrays.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10744>
_______________________________________


More information about the New-bugs-announce mailing list