mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
#12017: merge with 3.2.
This commit is contained in:
commit
9c18778695
3 changed files with 29 additions and 4 deletions
|
|
@ -943,6 +943,7 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
|
|||
|
||||
Returns a new PyObject representation of the term.
|
||||
*/
|
||||
PyObject *res;
|
||||
Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
|
||||
Py_ssize_t length = PyUnicode_GET_SIZE(pystr);
|
||||
if (idx >= length) {
|
||||
|
|
@ -957,10 +958,20 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
|
|||
next_idx_ptr);
|
||||
case '{':
|
||||
/* object */
|
||||
return _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
|
||||
if (Py_EnterRecursiveCall(" while decoding a JSON object "
|
||||
"from a unicode string"))
|
||||
return NULL;
|
||||
res = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
|
||||
Py_LeaveRecursiveCall();
|
||||
return res;
|
||||
case '[':
|
||||
/* array */
|
||||
return _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
|
||||
if (Py_EnterRecursiveCall(" while decoding a JSON array "
|
||||
"from a unicode string"))
|
||||
return NULL;
|
||||
res = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
|
||||
Py_LeaveRecursiveCall();
|
||||
return res;
|
||||
case 'n':
|
||||
/* null */
|
||||
if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue