A bug in struct module on the 64-bit platform?

ahn1 at llnl.gov ahn1 at llnl.gov
Wed Nov 30 19:14:41 EST 2005


Hi,

I have a user who complained about how "struct" module computes C
struct data size on Itanium2 based 64-bit machine.

His first reproducer was
--------------------------------------
#!/usr/local/bin/python
import struct
fmthead = '12id5i5d7id5i3di12i3di'
fmtsize = struct.calcsize(fmthead)
print fmthead,fmtsize
--------------------------------------
And it prints 12id5i5d7id5i3di12i3di 292

And he further provided
   >>struct.calcsize('idi')
   16
   >>struct.calcsize('idid')
   24
   >>struct.calcsize('did')
   20

In response to those, I created corresponding C struct and computed the
data size using "sizeof" operation (gcc was used for compilation), but
they don't seem to match.

Is this a known problem?

Best,
-Dong




More information about the Python-list mailing list