mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
_PyUnicode_Dump() indicates if wstr and/or utf8 are shared
This commit is contained in:
parent
1c8d0c76a1
commit
a849a4b6b4
1 changed files with 16 additions and 15 deletions
|
@ -670,23 +670,24 @@ void
|
||||||
_PyUnicode_Dump(PyObject *op)
|
_PyUnicode_Dump(PyObject *op)
|
||||||
{
|
{
|
||||||
PyASCIIObject *ascii = (PyASCIIObject *)op;
|
PyASCIIObject *ascii = (PyASCIIObject *)op;
|
||||||
printf("%s: len=%zu, wstr=%p",
|
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
|
||||||
unicode_kind_name(op),
|
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
|
||||||
ascii->length,
|
void *data;
|
||||||
ascii->wstr);
|
printf("%s: len=%zu, ",unicode_kind_name(op), ascii->length);
|
||||||
|
if (ascii->state.compact)
|
||||||
|
data = (compact + 1);
|
||||||
|
else
|
||||||
|
data = unicode->data.any;
|
||||||
|
if (ascii->wstr == data)
|
||||||
|
printf("shared ");
|
||||||
|
printf("wstr=%p", ascii->wstr);
|
||||||
if (!ascii->state.ascii) {
|
if (!ascii->state.ascii) {
|
||||||
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
|
printf(" (%zu), ", compact->wstr_length);
|
||||||
printf(" (%zu), utf8=%p (%zu)",
|
if (!ascii->state.compact && compact->utf8 == unicode->data.any)
|
||||||
compact->wstr_length,
|
printf("shared ");
|
||||||
compact->utf8,
|
printf("utf8=%p (%zu)", compact->utf8, compact->utf8_length);
|
||||||
compact->utf8_length);
|
|
||||||
}
|
}
|
||||||
if (!ascii->state.compact) {
|
printf(", data=%p\n", data);
|
||||||
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
|
|
||||||
printf(", data=%p",
|
|
||||||
unicode->data.any);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue