[Patches] [ python-Patches-532180 ] fix xmlrpclib float marshalling bug
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 20 Mar 2002 08:03:02 -0800
Patches item #532180, was opened at 2002-03-19 23:28
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=532180&group_id=5470
Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Quinlan (bquinlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix xmlrpclib float marshalling bug
Initial Comment:
As it stands now, xmlrpclib can send doubles, such as
1.#INF, that are not part of the XML-RPC standard.
This patch causes a ValueError to be raised instead.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-03-20 17:03
Message:
Logged In: YES
user_id=21627
You are right. An even better patch would check for
compliance with the protocol. Currently, the xmlrpc spec says
# There is no representation for infinity or negative
# infinity or "not a number". 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.
That would be best validated with a regular expression.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-03-20 16:02
Message:
Logged In: YES
user_id=31435
Note that the patch only catches "the problem" on a
platform whose C library can't read back its own float
output. Windows is in that class, but many other platforms
aren't.
It would be better to see whether 'n' or 'N' appear in the
repr() (that would catch variations of 'inf', 'INF', 'NaN'
and 'IND', while no "normal" float contains n).
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-03-20 08:28
Message:
Logged In: YES
user_id=21627
It seems repr of the float is computed twice in every case.
I recommend to save the result of the first computation.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=532180&group_id=5470