New submission from benrg <benrud...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue11430>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to