Bugs item #1084279, was opened at 2004-12-13 05:07 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1084279&group_id=5470
Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Antoine Pitrou (pitrou) Assigned to: Martin v. Löwis (loewis) Summary: status of small floats in xml-rpc ? Initial Comment: Hi, I've been reading through the xmlrpclib.py code to see that floats are marshalled the following way: def dump_double(self, value, write): write("<value><double>") write(repr(value)) write("</double></value>\n") dispatch[FloatType] = dump_double Using repr() means that small or big floats, for example, will be output using the exponent notation: >>> repr(2**-15) '3.0517578125e-05' Unfortunately, the XML-RPC specification does not allow this notation: "At this time, only decimal point notation is allowed, a plus or a minus, followed by any number of numeric characters, followed by a period and any number of numeric characters. Whitespace is not allowed. The range of allowable values is implementation-dependent, is not specified." (http://www.xmlrpc.com/spec) Thus floats marshalled using xmlrpclib may not be readable using other XML-RPC implementations. (I don't have any concrete data about this though) ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2004-12-13 08:13 Message: Logged In: YES user_id=80475 See attached patch. ---------------------------------------------------------------------- Comment By: Raymond Hettinger (rhettinger) Date: 2004-12-13 07:40 Message: Logged In: YES user_id=80475 I loaded a recipe for a helper function that meets the spec: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/358361 Inserting and applying the helper function ought to be backwards compatible (the new encoding is readable by previous versions). Martin, do you agree with approach and concur that it should be backported? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1084279&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com