[Python-checkins] cpython (merge 3.3 -> 3.4): merge 3.3

benjamin.peterson python-checkins at python.org
Mon Apr 14 17:52:19 CEST 2014


http://hg.python.org/cpython/rev/ef52ae167555
changeset:   90259:ef52ae167555
branch:      3.4
parent:      90254:6c18b941e850
parent:      90258:37adcd9ffa1c
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Apr 14 11:48:21 2014 -0400
summary:
  merge 3.3

files:
  Modules/_json.c |  9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)


diff --git a/Modules/_json.c b/Modules/_json.c
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -941,10 +941,11 @@
     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) {
         raise_stop_iteration(idx);
         return NULL;
     }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list