mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Cleanup code: remove int/long idioms and simplify a while statement.
This commit is contained in:
parent
8d48b43ea9
commit
2bb96f593a
5 changed files with 10 additions and 35 deletions
|
@ -535,15 +535,6 @@ class Marshaller:
|
|||
write("<value><nil/></value>")
|
||||
dispatch[type(None)] = dump_nil
|
||||
|
||||
def dump_int(self, value, write):
|
||||
# in case ints are > 32 bits
|
||||
if value > MAXINT or value < MININT:
|
||||
raise OverflowError("int exceeds XML-RPC limits")
|
||||
write("<value><int>")
|
||||
write(str(value))
|
||||
write("</int></value>\n")
|
||||
#dispatch[int] = dump_int
|
||||
|
||||
def dump_bool(self, value, write):
|
||||
write("<value><boolean>")
|
||||
write(value and "1" or "0")
|
||||
|
@ -558,6 +549,9 @@ class Marshaller:
|
|||
write("</int></value>\n")
|
||||
dispatch[int] = dump_long
|
||||
|
||||
# backward compatible
|
||||
dump_int = dump_long
|
||||
|
||||
def dump_double(self, value, write):
|
||||
write("<value><double>")
|
||||
write(repr(value))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue