From: Benjamin Peterson Date: Mon, 14 Apr 2014 15:48:21 +0000 (-0400) Subject: merge 3.3 X-Git-Tag: v3.4.1rc1~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70d92a96ab47e0b8b9cb78d437b3761296f815ed;p=python merge 3.3 --- 70d92a96ab47e0b8b9cb78d437b3761296f815ed diff --cc Modules/_json.c index 7d627cb2c5,4bc585dc2a..20f4614c7d --- a/Modules/_json.c +++ b/Modules/_json.c @@@ -941,11 -975,12 +941,12 @@@ scan_once_unicode(PyScannerObject *s, P kind = PyUnicode_KIND(pystr); length = PyUnicode_GET_LENGTH(pystr); - if (idx < 0) - /* Compatibility with Python version. */ - idx += length; - if (idx < 0 || idx >= length) { + if (idx < 0) { + PyErr_SetString(PyExc_ValueError, "idx cannot be negative"); + return NULL; + } + if (idx >= length) { - PyErr_SetNone(PyExc_StopIteration); + raise_stop_iteration(idx); return NULL; }