PyObject *memokey;
/* read key */
- if (str[idx] != '"') {
+ 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);
idx = next_idx;
/* skip whitespace between key and : delimiter, read :, skip whitespace */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- if (idx > end_idx || str[idx] != ':') {
+ 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++;
/* bail if the object is closed or we didn't get the , delimiter */
if (idx > end_idx) break;
- if (str[idx] == '}') {
+ if (PyUnicode_READ(kind, str, idx) == '}') {
break;
}
- else if (str[idx] != ',') {
+ else if (PyUnicode_READ(kind, str, idx) != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;
/* bail if the array is closed or we didn't get the , delimiter */
if (idx > end_idx) break;
- if (str[idx] == ']') {
+ if (PyUnicode_READ(kind, str, idx) == ']') {
break;
}
- else if (str[idx] != ',') {
+ else if (PyUnicode_READ(kind, str, idx) != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
+ raise_errmsg("Expecting ',' delimiter", pystr, idx);
goto bail;
}
idx++;