This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Anoop.Thomas.Mathew, Gallaecio, docs@python, ezio.melotti, ncoghlan, serhiy.storchaka, vajrasky
Date 2013-10-20.04:12:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Discussing this with Ezio on IRC, we decided that it probably makes more sense to do this check outside the scanner as preliminary validation of the input passed in via the public API. That will minimise the overhead and also avoids any potential side effects if "idx==0" is ever true in cases we're not currently testing.

The tests from the current patches should be OK, though.

Ezio also found that, for Py3k, adding an explicit check for non-str input and throwing an appropriate error would also be an improvement over the status quo:

>>> import json
>>> json.loads(b'')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ncoghlan/devel/py3k/Lib/json/", line 316, in loads
    return _default_decoder.decode(s)
  File "/home/ncoghlan/devel/py3k/Lib/json/", line 344, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: can't use a string pattern on a bytes-like object
Date User Action Args
2013-10-20 04:12:52ncoghlansetrecipients: + ncoghlan, ezio.melotti, docs@python, serhiy.storchaka, Anoop.Thomas.Mathew, vajrasky, Gallaecio
2013-10-20 04:12:52ncoghlansetmessageid: <>
2013-10-20 04:12:52ncoghlanlinkissue18958 messages
2013-10-20 04:12:52ncoghlancreate