This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients Elizacat, cameron, ethan.furman, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, yselivanov
Date 2017-01-21.11:30:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484998237.9.0.539610418335.issue29328@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-01-21 11:30:37mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, pitrou, cameron, ethan.furman, serhiy.storchaka, yselivanov, Elizacat
2017-01-21 11:30:37mark.dickinsonsetmessageid: <1484998237.9.0.539610418335.issue29328@psf.upfronthosting.co.za>
2017-01-21 11:30:37mark.dickinsonlinkissue29328 messages
2017-01-21 11:30:37mark.dickinsoncreate