diff options
author | Barry Warsaw <barry@python.org> | 1997-05-29 21:01:35 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-05-29 21:01:35 (GMT) |
commit | 1d0fe31d7e4d3d7a756678e991c3284202877cda (patch) | |
tree | 070a5cb14bdf404d2a6beea953599c4f6e016dc5 /configure | |
parent | 8d1ac0225cd18e05b694f51e29a1267c94e44147 (diff) | |
download | cpython-1d0fe31d7e4d3d7a756678e991c3284202877cda.zip cpython-1d0fe31d7e4d3d7a756678e991c3284202877cda.tar.gz cpython-1d0fe31d7e4d3d7a756678e991c3284202877cda.tar.bz2 |
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
Diffstat (limited to 'configure')
0 files changed, 0 insertions, 0 deletions