summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-03 22:00:20 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-03 22:00:20 (GMT)
commit7f11ad4594f63dec8cd18a16243fb58cf0e9589b (patch)
treed5c81289d92b0bed367d1c4b147e50d022ac7662 /Include
parent03490918b7810341b7cdf53e5a45798ad4b6c61e (diff)
downloadcpython-7f11ad4594f63dec8cd18a16243fb58cf0e9589b.zip
cpython-7f11ad4594f63dec8cd18a16243fb58cf0e9589b.tar.gz
cpython-7f11ad4594f63dec8cd18a16243fb58cf0e9589b.tar.bz2
Unicode: document when the wstr pointer is shared with data
Add also related assertions to _PyUnicode_CheckConsistency().
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 331e839..8e19ebc 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -226,6 +226,9 @@ typedef struct {
* ready = 1
* ascii = 0
* utf8 != data
+ * wstr is shared with data if kind=PyUnicode_2BYTE_KIND
+ and sizeof(wchar_t)=2 or if kind=PyUnicode_4BYTE_KIND and
+ sizeof(wchar_4)=4
- legacy string, not ready:
@@ -247,7 +250,10 @@ typedef struct {
* compact = 0
* ready = 1
* data.any is not NULL
- * utf8 = data if ascii is 1
+ * utf8 is shared with data.any if ascii = 1
+ * wstr is shared with data.any if kind=PyUnicode_2BYTE_KIND
+ and sizeof(wchar_t)=2 or if kind=PyUnicode_4BYTE_KIND and
+ sizeof(wchar_4)=4
Compact strings use only one memory block (structure + characters),
whereas legacy strings use one block for the structure and one block