Issue #5067: improve some json error messages.
Patch by Serhiy Storchaka.
diff --git a/Modules/_json.c b/Modules/_json.c
index 434b83c..e8a288b 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1032,7 +1032,7 @@
while (idx <= end_idx) {
/* read key */
if (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);
@@ -1043,7 +1043,7 @@
/* skip whitespace between key and : delimiter, read :, skip whitespace */
while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
if (idx > end_idx || str[idx] != ':') {
- raise_errmsg("Expecting : delimiter", pystr, idx);
+ raise_errmsg("Expecting ':' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1075,7 +1075,7 @@
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
@@ -1236,7 +1236,7 @@
break;
}
else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;