mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
merge 3.2
This commit is contained in:
commit
156285c35f
4 changed files with 12 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue