[New-bugs-announce] [issue9249] struct.pack and Long Integer datatype should be 4, but is 8 bytes

hannes reuter report at bugs.python.org
Tue Jul 13 17:00:09 CEST 2010


New submission from hannes reuter <gisxperts at googlemail.com>:

on http://docs.python.org/library/struct.html
in section 7.3.2.2. Format Characters in the table one can find that 
L -> unsigned long -> 	integer-> should have a 4 byte dataspace.
(same applies for l), which seems to be correct -> 32bit/8=4


On a Ubuntu 64 , Python 2.6,  
a) calcsize reports it uses 8 byte
b) by writing data to a file and reading it back in I could confirm that it uses as well 8 bytes of binary data -> ofile2.write(struct.pack('LL',int(x[0]), int(x[1])))

Q: Is that behavior what we see a Docu error ?
Q: Is that behavior what we see general struct problem ? 
add1: in # 2263 e.g. we see problems for L type data in relation to np ?  
add2: IMHO certainly not a padding problem like in #7355


for reproduction:

from struct import *
calcsize('H')
2 -> correct to docu
calcsize('f')
4 -> correct to docu
calcsize('L')
8   -> should be 4
calcsize('l')
8 -> should be 4
calcsize('x')
1 -> correct to docu

So either docu is wrong, or struct has an error.

----------
assignee: theller
components: ctypes
messages: 110201
nosy: hannes.reuter, theller
priority: normal
severity: normal
status: open
title: struct.pack and Long Integer datatype should be 4, but is 8 bytes
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9249>
_______________________________________


More information about the New-bugs-announce mailing list