mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #5067: improve some json error messages.
Patch by Serhiy Storchaka.
This commit is contained in:
commit
802d669044
5 changed files with 14 additions and 12 deletions
|
|
@ -646,7 +646,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
|||
|
||||
/* read key */
|
||||
if (PyUnicode_READ(kind, str, idx) != '"') {
|
||||
raise_errmsg("Expecting property name", pystr, idx);
|
||||
raise_errmsg("Expecting property name enclosed in double quotes", pystr, idx);
|
||||
goto bail;
|
||||
}
|
||||
key = scanstring_unicode(pystr, idx + 1, strict, &next_idx);
|
||||
|
|
@ -667,7 +667,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
|||
/* skip whitespace between key and : delimiter, read :, skip whitespace */
|
||||
while (idx <= end_idx && IS_WHITESPACE(PyUnicode_READ(kind, str, idx))) idx++;
|
||||
if (idx > end_idx || PyUnicode_READ(kind, str, idx) != ':') {
|
||||
raise_errmsg("Expecting : delimiter", pystr, idx);
|
||||
raise_errmsg("Expecting ':' delimiter", pystr, idx);
|
||||
goto bail;
|
||||
}
|
||||
idx++;
|
||||
|
|
@ -707,7 +707,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
|||
break;
|
||||
}
|
||||
else if (PyUnicode_READ(kind, str, idx) != ',') {
|
||||
raise_errmsg("Expecting , delimiter", pystr, idx);
|
||||
raise_errmsg("Expecting ',' delimiter", pystr, idx);
|
||||
goto bail;
|
||||
}
|
||||
idx++;
|
||||
|
|
@ -797,7 +797,7 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi
|
|||
break;
|
||||
}
|
||||
else if (PyUnicode_READ(kind, str, idx) != ',') {
|
||||
raise_errmsg("Expecting , delimiter", pystr, idx);
|
||||
raise_errmsg("Expecting ',' delimiter", pystr, idx);
|
||||
goto bail;
|
||||
}
|
||||
idx++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue