* compact = 1
* ready = 1
* ascii = 0
+ * utf8 != data
- string created by the legacy API (not ready):
* compact = 0
* ready = 1
* data.any is not NULL
+ * utf8 = data if ascii is 1
String created by the legacy API becomes ready when calling
PyUnicode_READY().
assert(ascii->state.ready == 1);
}
else if (ascii->state.compact == 1) {
+ PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
assert(kind == PyUnicode_1BYTE_KIND
|| kind == PyUnicode_2BYTE_KIND
|| kind == PyUnicode_4BYTE_KIND);
assert(ascii->state.ascii == 0);
assert(ascii->state.ready == 1);
+ assert (compact->utf8 != (void*)(compact + 1));
} else {
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
assert(ascii->state.compact == 0);
assert(ascii->state.ready == 1);
assert(unicode->data.any != NULL);
+ if (ascii->state.ascii)
+ assert (compact->utf8 == unicode->data.any);
+ else
+ assert (compact->utf8 != unicode->data.any);
}
}
return 1;