summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-10-03 10:12:11 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-10-03 10:12:11 (GMT)
commita849a4b6b4c29f4cad0ee71a9fc5ebc16f6bb504 (patch)
tree48300c9cdb9b17ddaec97465c57277eec9acd4f2 /Objects
parent1c8d0c76a17283f165c6140e5e537d0bdc482057 (diff)
downloadcpython-a849a4b6b4c29f4cad0ee71a9fc5ebc16f6bb504.zip
cpython-a849a4b6b4c29f4cad0ee71a9fc5ebc16f6bb504.tar.gz
cpython-a849a4b6b4c29f4cad0ee71a9fc5ebc16f6bb504.tar.bz2
_PyUnicode_Dump() indicates if wstr and/or utf8 are shared
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index e8b19cf..6e4ef3d 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -670,23 +670,24 @@ void
_PyUnicode_Dump(PyObject *op)
{
PyASCIIObject *ascii = (PyASCIIObject *)op;
- printf("%s: len=%zu, wstr=%p",
- unicode_kind_name(op),
- ascii->length,
- ascii->wstr);
+ 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);
+ else
+ data = unicode->data.any;
+ if (ascii->wstr == data)
+ printf("shared ");
+ printf("wstr=%p", ascii->wstr);
if (!ascii->state.ascii) {
- PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
- printf(" (%zu), utf8=%p (%zu)",
- compact->wstr_length,
- compact->utf8,
- compact->utf8_length);
- }
- if (!ascii->state.compact) {
- PyUnicodeObject *unicode = (PyUnicodeObject *)op;
- printf(", data=%p",
- unicode->data.any);
+ printf(" (%zu), ", compact->wstr_length);
+ if (!ascii->state.compact && compact->utf8 == unicode->data.any)
+ printf("shared ");
+ printf("utf8=%p (%zu)", compact->utf8, compact->utf8_length);
}
- printf("\n");
+ printf(", data=%p\n", data);
}
#endif