New submission from Steve Krenzel :
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.
--
components: Library (Lib)
messages: 95467
nosy: sgk284
severity: normal
status: open
title: Struct incorrectly compiles format strings
type: behavior
versions: Python 2.5, Python 2.6
___
Python tracker
<http://bugs.python.org/issue7355>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com