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 sgk284
Recipients sgk284
Date 2009-11-19.09:41:59
SpamBayes Score 6.286083e-13
Marked as misclassified No
Message-id <1258623721.25.0.299543316527.issue7355@psf.upfronthosting.co.za>
In-reply-to
Content
The struct module has a calcsize() method which reports the size of the data for a specified format 
string. In some instances, to the best of my knowledge, this is wrong.

To repro:
>>> from struct import calcsize
>>> calcsize("ci")
8
>>> calcsize("ic")
5

The correct answer is 5 (a single byte character and a four byte int take up 5 bytes of space). For 
some reason when a 'c' is followed by an 'i', this is wrong and instead allocates 4 bytes to the 'c'.
This has been verified in 2.6 and 2.5.

You can also repro this by using 's', '2c', and similar combinations in place of 'c'. as well as 'I' 
in place of 'i'. This might effect other combinations as well.
History
Date User Action Args
2009-11-19 09:42:01sgk284setrecipients: + sgk284
2009-11-19 09:42:01sgk284setmessageid: <1258623721.25.0.299543316527.issue7355@psf.upfronthosting.co.za>
2009-11-19 09:41:59sgk284linkissue7355 messages
2009-11-19 09:41:59sgk284create