]> granicus.if.org Git - python/commitdiff
merge 3.3
authorBenjamin Peterson <benjamin@python.org>
Mon, 14 Apr 2014 15:48:21 +0000 (11:48 -0400)
committerBenjamin Peterson <benjamin@python.org>
Mon, 14 Apr 2014 15:48:21 +0000 (11:48 -0400)
1  2 
Modules/_json.c

diff --cc Modules/_json.c
index 7d627cb2c5494733da6cf9d57c1f2ac4d03832a5,4bc585dc2ab0d610b8019126e7df388838f9ade2..20f4614c7d942821946a2b6d7c76ccd480278d15
@@@ -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;
      }