Antoine Pitrou added the comment:
Actually, this isn't a problem in _json.c but in the re library:
JSONDecoder.raw_decode() works fine, but JSONDecoder.decode() raises:
$ ./python -c "import json.decoder;
print(json.decoder.JSONDecoder().raw_decode('[%2200000000s' % ']'))"
([], 2200000001)
$ ./python -c "import json.decoder;
print(json.decoder.JSONDecoder().decode('[%2200000000s' % ']'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/antoine/cpython/default/Lib/json/decoder.py", line 347, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column -2094967295 - line 1 column 2200000001
(char -2094967295 - 2200000001)
(decode() is basically raw_decode() followed by a call to WHITESPACE.match()
from the end of the JSON object:
http://hg.python.org/cpython/file/2c04d2102534/Lib/json/decoder.py#l339
)
----------
nosy: +pitrou
stage: -> needs patch
_______________________________________
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