New submission from hannes reuter <gisxpe...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue9249>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to