|
|
If you parse a string float in 2.0.9 (Mac 10.5/Ubuntu Intrepid), everything is fine:
>>> simplejson.loads('3.14')
3.1400000000000001
Everything is also OK with unicode and a single fractional digit:
>>> simplejson.loads(u'3.1')
3.1000000000000001
Everything is also OK with unicode placed in an enclosing data structure:
>>> simplejson.loads(u'[3.14]')
[3.1400000000000001]
However, if it is a unicode float, with multiple fractional digits, with no enclosing data structure,
there is a problem:
>>> simplejson.loads(u'3.14')
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/Users/gary/.buildout/eggs/simplejson-2.0.9-py2.4-macosx-10.5-
i386.egg/simplejson/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/Users/gary/.buildout/eggs/simplejson-2.0.9-py2.4-macosx-10.5-
i386.egg/simplejson/decoder.py", line 338, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 3 - line 1 column 4 (char 3 - 4)
|