Dustin Boswell added the comment:
I thought simplejson was a standard module for 2.6, and got renamed to json
(replacing the older json module) in later versions.
For instance, I get the same problem with 2.7 (no simplejson):
python2.7 -c "import json; json.loads('[' + '''\".......\", ''' * 200000000 +
'0]') "
^AcTraceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python2.7/json/decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column -2094967293 - line 1 column 2200000003
(char -2094967293 - 2200000003)
And if I use the "json" module in 2.6 (which is 10x slower, takes over 30
minutes to run) it also fails, but with a difference trace:
python2.6 -c "import json; json.loads('[' + '''\".......\", ''' * 200000000 +
'0]') "
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.6/json/decoder.py", line 336, in raw_decode
obj, end = self._scanner.iterscan(s, **kw).next()
File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
File "/usr/lib/python2.6/json/decoder.py", line 217, in JSONArray
value, end = iterscan(s, idx=end, context=context).next()
File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
File "/usr/lib/python2.6/json/decoder.py", line 155, in JSONString
return scanstring(match.string, match.end(), encoding, strict)
ValueError: end is out of bounds
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16586>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com