Discussion:
test_struct @ alpha/linux
Anders Qvist
2002-11-03 10:38:43 UTC
Permalink
More info on asmodean test_struct breakage.

[ 11:27 ] - ./python
Python 2.3a0 (#1, Nov 3 2002, 09:57:48)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import struct
c = 'a'
b = 1
h = 255
i = 65535
l = 65536
f = 3.1415
d = 3.1415
format = 'xcbhilfd'
s = struct.pack(format, c, b, h, i, l, f, d)
cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
l
65536
lp
0

This seems incorrect.
format = 'xcBHILfd'
s = struct.pack(format, c, b, h, i, l, f, d)
cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
l
65536
lp
0L

Same here.
cp, bp, hp, ip, lp, fp, dp
('a', 1, 255, 65535L, 0L, 3.1414999961853027, 8.3693289810785051e-154)

This isn't the newest compiler on the planet, so it may be a problem
there. It's a RedHat 6.2 box with /lib/libc-2.1.3.so.
--
Anders "Quest" Qvist

"We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare. Now, thanks
to the Internet, we know this is not true." -- Robert Wilensky
Loading...