Commit Graph

13 Commits

Author SHA1 Message Date
Martin v. Löwis
c47016ee74 Use (c)StringIO for collecting bytes. Fixes bug #451622. 2001-08-16 17:06:44 +00:00
Skip Montanaro
40fc16059f final round of __all__ lists (I hope) - skipped urllib2 because Moshe may be
giving it a slight facelift
2001-03-01 04:27:19 +00:00
Tim Peters
e119006e7d Whitespace normalization. Top level of Lib now fixed-point for reindent.py! 2001-01-15 03:34:38 +00:00
Fred Drake
8152d32375 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Guido van Rossum
45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
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
Barry Warsaw
7e98bda43b Raise ConversionError instances the new fangled way, e.g.:
raise ConversionError, msg

where `msg' is passed as the argument to the constructor.
1997-01-14 17:11:02 +00:00
Guido van Rossum
6083f0e9ce Use the new struct module's ability to pack and unpack standardized
data formats.  The _xdr module is no longer used, since struct
supports the required IEEE floats and doubles.

(I have one doubt about not using _xdr.  The struct module doesn't
handle Inf, NaN and gradual underflow correctly.  If the _xdr module
does these things better, it may still have a (small) competitive
advantage.  On the other hand, since not all platforms support IEEE
floating point, it's not clear that it would be a good idea to ever
transfer Inf or NaNs.  Gradual underflow can be fixed in the struct
module.
1997-01-02 22:52:15 +00:00
Barry Warsaw
75eccc5bcf Unpacker.get_buffer(): new method to access the internal buffer of data 1996-12-04 22:04:39 +00:00
Guido van Rossum
176f10e3d5 Get rid of evil workaround for Python 1.4b2 bug. 1996-10-22 18:59:47 +00:00
Guido van Rossum
a9b60d9411 No double underscores for globals please 1996-08-26 22:34:57 +00:00
Guido van Rossum
72fba794d6 Rename __test() to _test(). 1996-08-19 22:49:35 +00:00
Guido van Rossum
731630b5bf XDR interface, evolved from Demo/rpc/xdr.py by Barry. 1996-08-19 22:26:43 +00:00