summaryrefslogtreecommitdiff
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-13 22:28:16 -0400
committerBenjamin Peterson <benjamin@python.org>2014-04-13 22:28:16 -0400
commit156285c35f8ff856883f09394653b000331e3e33 (patch)
tree76fe7455051296fdbb57ced15fb20ec7d321c4ce /Modules/_json.c
parentf5c34054f9ea1fbdaeafdcf1a6f17f64f4dfed63 (diff)
parent99b5afab74428e5ddfd877bdf3aa8a8c479696b1 (diff)
downloadcpython-git-156285c35f8ff856883f09394653b000331e3e33.tar.gz
merge 3.2
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 9166680289..ec980c93fa 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -975,7 +975,10 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
kind = PyUnicode_KIND(pystr);
length = PyUnicode_GET_LENGTH(pystr);
- if (idx >= length) {
+ if (idx < 0)
+ /* Compatibility with Python version. */
+ idx += length;
+ if (idx < 0 || idx >= length) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}