diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:28:16 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:28:16 (GMT) |
commit | 156285c35f8ff856883f09394653b000331e3e33 (patch) | |
tree | 76fe7455051296fdbb57ced15fb20ec7d321c4ce /Modules | |
parent | f5c34054f9ea1fbdaeafdcf1a6f17f64f4dfed63 (diff) | |
parent | 99b5afab74428e5ddfd877bdf3aa8a8c479696b1 (diff) | |
download | cpython-156285c35f8ff856883f09394653b000331e3e33.zip cpython-156285c35f8ff856883f09394653b000331e3e33.tar.gz cpython-156285c35f8ff856883f09394653b000331e3e33.tar.bz2 |
merge 3.2
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_json.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 9166680..ec980c9 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; } |