summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpclib.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2001-10-10 15:56:34 (GMT)
committerSkip Montanaro <skip@pobox.com>2001-10-10 15:56:34 (GMT)
commit5e9c71ba80355d84c7984287a64fb670cb1a38d1 (patch)
treedd60a7ff49aa8a4e2be397d924762350443939e0 /Lib/xmlrpclib.py
parent22e94e2051836a0947b645f9e2263d9ec514f861 (diff)
downloadcpython-5e9c71ba80355d84c7984287a64fb670cb1a38d1.zip
cpython-5e9c71ba80355d84c7984287a64fb670cb1a38d1.tar.gz
cpython-5e9c71ba80355d84c7984287a64fb670cb1a38d1.tar.bz2
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.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r--Lib/xmlrpclib.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index 4e98c4c..4221bcc 100644
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -33,6 +33,7 @@
# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup)
# 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.
# Copyright (c) 1999-2001 by Fredrik Lundh.
@@ -464,6 +465,11 @@ class Marshaller:
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):
self.write("<value><double>%s</double></value>\n" % value)
dispatch[FloatType] = dump_double