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 boa124, mark.dickinson
Date 2013-04-02.13:34:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364909646.88.0.351139033381.issue17617@psf.upfronthosting.co.za>
In-reply-to
Content
This is working as designed: the result of struct.calcsize matches the length of the string that you'll get back from struct.pack using that format.  Padding isn't included after the last entry in the struct.

That's not to say that it was a good design decision, but that's the design that was chosen, and it's not realistic to change this for the bugfix releases.  It may be possible to do something for Python 3.4.

You can add a '0L' to the end of your struct to force padding bytes at the end.  See:

http://docs.python.org/2/library/struct.html#examples

for an example of this.

See also #7189, #5145.
History
Date User Action Args
2013-04-02 13:34:06mark.dickinsonsetrecipients: + mark.dickinson, boa124
2013-04-02 13:34:06mark.dickinsonsetmessageid: <1364909646.88.0.351139033381.issue17617@psf.upfronthosting.co.za>
2013-04-02 13:34:06mark.dickinsonlinkissue17617 messages
2013-04-02 13:34:06mark.dickinsoncreate