[Patches] [ python-Patches-925932 ] struct.pack() on 64bit
architectures
SourceForge.net
noreply at sourceforge.net
Tue Mar 30 10:57:22 EST 2004
Patches item #925932, was opened at 2004-03-30 05:55
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=925932&group_id=5470
Category: Tests
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Aleksander Piotrowski (pelotas)
Assigned to: Nobody/Anonymous (nobody)
Summary: struct.pack() on 64bit architectures
Initial Comment:
I'm running python on OpenBSD/sparc64 (SUN Ultra 10).
On this machine struct.pack() gives me:
>>> struct.pack('l', 1)
'\x00\x00\x00\x00\x00\x00\x00\x01'
>>> struct.pack('i', 1)
'\x00\x00\x00\x01'
On i386 box I have:
>>> struct.pack('l', 1)
'\x01\x00\x00\x00'
>>> struct.pack('i', 1)
'\x01\x00\x00\x00'
Because of this, OpenBSD port uses attached patch. I
guess that this is generic problem (not OpenBSD
specific) and every 64bit platform would suffer.
Am I right?
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-03-30 10:57
Message:
Logged In: YES
user_id=31435
For a Unix-head reviewer: the patch is to test_fcntl.py,
which uses a native struct.pack() to build a lockdata
argument for fcntl. On the OP's box, it constructs stuff of
the wrong size, due to "l" format codes producing 8-byte
thingies. The patch changes the "l" codes to "i" on the OP's
platform.
I wonder whether we couldn't instead use "i" codes on all BSD-
ish platforms -- on 32-bit boxes, "i" is synonymous with "l",
while on 64-bit boxes it looks like "l" is wrong but "i" is correct.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=925932&group_id=5470
More information about the Patches
mailing list