diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:31:42 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-04-14 02:31:42 (GMT) |
commit | 584f5cbf16980f21c58bf7ce7e451e022355fa3d (patch) | |
tree | 5fb3623c73a49499d71d382723c283f3b83a8478 /Modules/_json.c | |
parent | d5aa487cceac54fdf2b5c073157b899b3c8c9c94 (diff) | |
parent | 156285c35f8ff856883f09394653b000331e3e33 (diff) | |
download | cpython-584f5cbf16980f21c58bf7ce7e451e022355fa3d.zip cpython-584f5cbf16980f21c58bf7ce7e451e022355fa3d.tar.gz cpython-584f5cbf16980f21c58bf7ce7e451e022355fa3d.tar.bz2 |
merge 3.3
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 125101f..7d627cb 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; } |