[New-bugs-announce] [issue11084] Serialization of decimal.Decimal to XML-RPC

GDR! report at bugs.python.org
Mon Jan 31 20:37:31 CET 2011

New submission from GDR! <gdr at go2.pl>:

xmlrpc.client (and xmlrpclib in 2.x) can't serialize instances of Decimal, throwing TypeError instead. Because XML is a textual format, converting from decimal to float may cause loss of data.

According to http://www.xmlrpc.com/spec, encoding Decimal as XML-RPC <double /> is allowed: "The range of allowable values is implementation-dependent, is not specified." Therefore, including decimal numbers that can not be represented by IEEE double is allowed by the spec.

Also, in my opinion, making a numeric type available in standard library unsupported by another part of standard library, is counterintuitive, but it's just my personal point of view.

I can provide a patch if this bug report is considered proper.

components: Library (Lib)
messages: 127651
nosy: gdr
priority: normal
severity: normal
status: open
title: Serialization of decimal.Decimal to XML-RPC
type: behavior
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list