Files
cpython/Lib
Barry Warsaw 1d0fe31d7e Packer.pack_uhyper(): Fixes needed to properly pack unsigned 64 bit
longs where the top bit is set.  First, change the masks so that they
are `L' longs, otherwise the sign bits will get propagated to the
result.  Next, do not coerce to int before sending to pack_uint()
otherwise Python will generate an OverflowError.  Here is a test
program that fails without the patch, but now succeeds:

import xdrlib

addr = (132, 151, 1, 71)
uint = 0L
for a in addr:
    uint = (uint << 8) | a

ulong64 = uint << 32

p = xdrlib.Packer()
p.pack_uhyper(ulong64)
buf = p.get_buffer()
u = xdrlib.Unpacker(buf)
ulong64prime = u.unpack_uhyper()

if ulong64 == ulong64prime:
    print 'okay'
else:
    print 'bogus'

print ulong64, ulong64prime
1997-05-29 21:01:35 +00:00
..
1996-08-08 18:24:58 +00:00
1996-08-08 18:24:58 +00:00
1997-05-22 20:48:03 +00:00
1997-05-22 20:48:03 +00:00
1996-12-13 00:19:15 +00:00
1996-01-26 17:43:46 +00:00
1996-08-16 18:14:41 +00:00
1996-08-08 18:24:58 +00:00
1996-08-08 18:24:58 +00:00
1996-12-13 00:19:15 +00:00
1996-08-16 18:14:41 +00:00
1996-08-20 20:00:51 +00:00
1994-03-07 11:45:36 +00:00
1996-01-25 18:26:57 +00:00
1996-08-21 14:32:37 +00:00
1993-10-22 14:24:22 +00:00
1994-10-09 22:34:40 +00:00
1994-10-09 22:34:40 +00:00
1995-01-04 19:20:00 +00:00
1997-05-28 19:31:14 +00:00
1992-03-31 18:55:40 +00:00
1992-12-14 12:57:56 +00:00
1997-05-09 03:21:44 +00:00
1995-08-10 19:27:42 +00:00
1996-05-28 22:58:40 +00:00
1992-01-01 19:35:13 +00:00
1995-01-27 02:41:45 +00:00
1995-01-27 02:41:45 +00:00
1992-03-15 21:37:43 +00:00
1996-09-11 19:43:52 +00:00
1997-04-02 05:47:11 +00:00
1992-04-06 14:03:53 +00:00
1997-04-30 16:04:57 +00:00
1996-05-28 23:18:55 +00:00
1996-02-13 00:02:10 +00:00
1997-04-11 18:59:38 +00:00
1997-05-21 14:59:17 +00:00
1997-04-16 02:47:12 +00:00
1997-04-11 15:22:56 +00:00
1996-06-26 19:47:56 +00:00
1994-10-20 22:02:03 +00:00
1996-09-10 17:40:16 +00:00
1995-09-30 16:48:54 +00:00
1996-10-10 16:00:28 +00:00
1993-12-29 15:33:08 +00:00
1997-05-08 23:11:04 +00:00
1991-08-16 13:28:11 +00:00
1991-12-30 16:03:05 +00:00
1997-04-29 14:45:19 +00:00
1996-08-17 19:56:26 +00:00
1997-04-02 05:49:46 +00:00
1996-06-19 14:54:19 +00:00
1997-04-02 05:49:46 +00:00
1996-08-20 20:40:07 +00:00
1997-04-02 05:46:05 +00:00
1995-08-10 19:43:04 +00:00
1997-04-11 19:00:53 +00:00
1996-08-21 14:32:37 +00:00
1994-03-07 11:45:36 +00:00
1996-05-28 22:56:16 +00:00
1991-04-21 19:34:48 +00:00
1997-04-08 19:46:53 +00:00
1996-08-20 20:40:07 +00:00
1992-01-01 19:35:13 +00:00