[issue11430] can't change the sizeof a Structure that doesn't own its buffer

benrg report at bugs.python.org
Mon Mar 7 09:12:35 CET 2011


New submission from benrg <benrudiak at gmail.com>:

A struct that is resized knows its new size; among other things, the new size is returned by sizeof.

But it seems to be impossible to increase the size of a struct that doesn't own its buffer. resize fails in this case. This would not be too bad if the size were merely informational, but unfortunately ctypes also uses it for bounds checking. This makes from_buffer and from_address a lot less useful than they would otherwise be.

I think that either resize should succeed when the underlying buffer is already large enough (or unconditionally in the case of from_address), or else from_buffer and from_address should take a size argument, or possibly both.

----------
assignee: theller
components: ctypes
messages: 130237
nosy: benrg, theller
priority: normal
severity: normal
status: open
title: can't change the sizeof a Structure that doesn't own its buffer
type: feature request
versions: Python 3.2

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


More information about the Python-bugs-list mailing list