Mark Dickinson added the comment:

A couple of questions that haven't been brought up yet:

1. Do you have any thoughts on how alignment should behave for '@'-style 
structs containing variable-length strings? I suspect the easiest solution may 
be simply to disallow that combination, and only allow variable-length strings 
for "standard" struct types (those with a format string starting with one of 
"=", "<", ">", "!"), where alignment isn't an issue.

2. For the Struct object, what should the .size attribute give for a 
variable-length struct? (Or should accessing the attribute raise an exception?)

3. Any thoughts about how the internal representation of the Struct object 
would need to change? I guess you'd want to drop the "offset" field of the 
"formatcode" struct, and compute the offsets on the fly during packing and 
unpacking (or would you try to keep the offset for the non-variable-length 
cases?). You'd probably also want to find a way to encode the information about 
whether the struct is variable-length or not in the PyStructObject struct. A 
key requirement here is that there should be no substantial performance 
regression for packing / unpacking with structs that don't use the 
variable-length feature. It doesn't seem likely to me that getting rid of the 
precalculated offset would cause such a regression, but it's something that 
should be checked.

----------

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

Reply via email to