diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-04-13 22:32:12 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-04-13 22:32:12 -0400 |
commit | 79f3ef63361b00e2e70a9d8edba6afa5096d3380 (patch) | |
tree | bb052ffba41cf895bb56b12a24b9c3f0730b96cb /Modules/_json.c | |
parent | e084e97f9f502908534bc87596c5bb7b6ff9a684 (diff) | |
parent | 584f5cbf16980f21c58bf7ce7e451e022355fa3d (diff) | |
download | cpython-git-79f3ef63361b00e2e70a9d8edba6afa5096d3380.tar.gz |
merge 3.4
Diffstat (limited to 'Modules/_json.c')
-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 125101fa7c..7d627cb2c5 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -941,7 +941,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) { raise_stop_iteration(idx); return NULL; } |