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

Guido van Rossum guido@python.org
Wed, 10 Oct 2001 18:12:06 -0400


> allow long ints to be marshalled as ints - no check is made to the incoming
> value, so the programmer will have to catch OverflowError.  I'm not sure
> what /F's perspective is on this.  Perhaps it should be caught and mapped to
> an xmlrpclib-specific exception.  None of the other type-specific dump
> methods seem to do any exception handling though.

In 2.2, why don't we just marshal str(value)?  If the receiving side
can handle bigints (as 2.2 can), it will automatically do the right
thing, right?  Or does xmlrpc have a restriction on the size of
<int>111111111111111111111111111111111111111111</int>?

--Guido van Rossum (home page: http://www.python.org/~guido/)

> Index: xmlrpclib.py
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -C2 -d -r1.11 -r1.12
> *** xmlrpclib.py	2001/10/02 18:33:11	1.11
> --- xmlrpclib.py	2001/10/10 15:56:34	1.12
> ***************
> *** 34,37 ****
> --- 34,38 ----
>   # 2001-10-01 fl  Remove containers from memo cache when done with them
>   # 2001-10-01 fl  Use faster escape method (80% dumps speedup)
> + # 2001-10-10 sm  Allow long ints to be passed as ints if they don't overflow
>   #
>   # Copyright (c) 1999-2001 by Secret Labs AB.
> ***************
> *** 464,467 ****
> --- 465,473 ----
>           self.write("<value><int>%s</int></value>\n" % value)
>       dispatch[IntType] = dump_int
> + 
> +     def dump_long(self, value):
> +         val = int(value)
> +         self.write("<value><int>%s</int></value>\n" % val)
> +     dispatch[LongType] = dump_long
>   
>       def dump_double(self, value):
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://mail.python.org/mailman/listinfo/python-checkins