mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fix data variable in _PyUnicode_Dump() for compact ASCII
This commit is contained in:
parent
d8e61c348e
commit
0d60e87ad6
1 changed files with 10 additions and 2 deletions
|
@ -838,14 +838,22 @@ _PyUnicode_Dump(PyObject *op)
|
||||||
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
|
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
|
||||||
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
|
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
|
||||||
void *data;
|
void *data;
|
||||||
printf("%s: len=%zu, ",unicode_kind_name(op), ascii->length);
|
|
||||||
if (ascii->state.compact)
|
if (ascii->state.compact)
|
||||||
data = (compact + 1);
|
{
|
||||||
|
if (ascii->state.ascii)
|
||||||
|
data = (ascii + 1);
|
||||||
|
else
|
||||||
|
data = (compact + 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
data = unicode->data.any;
|
data = unicode->data.any;
|
||||||
|
printf("%s: len=%zu, ",unicode_kind_name(op), ascii->length);
|
||||||
|
|
||||||
if (ascii->wstr == data)
|
if (ascii->wstr == data)
|
||||||
printf("shared ");
|
printf("shared ");
|
||||||
printf("wstr=%p", ascii->wstr);
|
printf("wstr=%p", ascii->wstr);
|
||||||
|
|
||||||
if (!(ascii->state.ascii == 1 && ascii->state.compact == 1)) {
|
if (!(ascii->state.ascii == 1 && ascii->state.compact == 1)) {
|
||||||
printf(" (%zu), ", compact->wstr_length);
|
printf(" (%zu), ", compact->wstr_length);
|
||||||
if (!ascii->state.compact && compact->utf8 == unicode->data.any)
|
if (!ascii->state.compact && compact->utf8 == unicode->data.any)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue