diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-23 19:47:19 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-23 19:47:19 +0200 |
commit | 0d60e87ad6d992c8b989dfa1909a2fd8e853ee9a (patch) | |
tree | 91d4f2180a14d92217ac687affb3671ca5dc6879 /Objects | |
parent | d8e61c348e23734dc138be18c29c74e6892fb86d (diff) | |
download | cpython-git-0d60e87ad6d992c8b989dfa1909a2fd8e853ee9a.tar.gz |
Fix data variable in _PyUnicode_Dump() for compact ASCII
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 547c857ac8..82d532fdee 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -838,14 +838,22 @@ _PyUnicode_Dump(PyObject *op) PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op; PyUnicodeObject *unicode = (PyUnicodeObject *)op; void *data; - printf("%s: len=%zu, ",unicode_kind_name(op), ascii->length); + if (ascii->state.compact) - data = (compact + 1); + { + if (ascii->state.ascii) + data = (ascii + 1); + else + data = (compact + 1); + } else data = unicode->data.any; + printf("%s: len=%zu, ",unicode_kind_name(op), ascii->length); + if (ascii->wstr == data) printf("shared "); printf("wstr=%p", ascii->wstr); + if (!(ascii->state.ascii == 1 && ascii->state.compact == 1)) { printf(" (%zu), ", compact->wstr_length); if (!ascii->state.compact && compact->utf8 == unicode->data.any) |