[New-bugs-announce] [issue11430] can't change the sizeof a Structure that doesn't own its buffer
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.
nosy: benrg, theller
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>
More information about the New-bugs-announce