[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib xmlrpclib.py,1.11,1.12

Tim Peters tim.one@home.com
Wed, 10 Oct 2001 22:25:46 -0400


[Skip]
> Presumably, after it is fully in effect, int("9999999999999999999999999")
> will just return a long, maybe not.

[Jeremy]
> If that happens, we'll need to fix xmlrpclib so that it doesn't
> marshal int that don't fit in 4 bytes :-).

If someone really cares about this, xmlrcplib is already broken in this
respect, at least on 64-bit Linux boxes (where Python ints have always been
64 bits).

def fits_in_n_bit_signed_int(i, n):
    signs = i >> (n-1)
    return signs == 0 or signs == -1