Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30134f5

Browse files
author
Victor Stinner
committed
Complete documentation of compact ASCII strings
1 parent b092365 commit 30134f5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Include/unicodeobject.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ typedef struct {
215215
* compact = 1
216216
* ascii = 1
217217
* ready = 1
218-
* utf8 = data
218+
* (length is the length of the utf8 and wstr strings)
219+
* (data starts just after the structure)
220+
* (since ASCII is decoded from UTF-8, the utf8 string are the data)
219221
220222
- compact:
221223
@@ -225,25 +227,26 @@ typedef struct {
225227
* compact = 1
226228
* ready = 1
227229
* ascii = 0
228-
* utf8 != data
230+
* utf8 is not shared with data
229231
* utf8_length = 0 if utf8 is NULL
230232
* wstr is shared with data and wstr_length=length
231233
if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2
232234
or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4
233235
* wstr_length = 0 if wstr is NULL
236+
* (data starts just after the structure)
234237
235238
- legacy string, not ready:
236239
237240
* structure = PyUnicodeObject
238241
* kind = PyUnicode_WCHAR_KIND
239242
* compact = 0
243+
* ascii = 0
240244
* ready = 0
241245
* wstr is not NULL
242246
* data.any is NULL
243247
* utf8 is NULL
244248
* utf8_length = 0
245249
* interned = SSTATE_NOT_INTERNED
246-
* ascii = 0
247250
248251
- legacy string, ready:
249252

0 commit comments

Comments
 (0)