@@ -2044,8 +2044,8 @@ Utility functions
20442044 to initialize the array items. Bytes not initialized this way are
20452045 set to zero (NUL).
20462046
2047- If *size * is not given (or if it is ``None ``), the buffer is made one byte
2048- larger than *init *, effectively adding a NUL termination byte .
2047+ If *size * is not given (or if it is ``None ``), the buffer is made one element
2048+ larger than *init *, effectively adding a NUL terminator .
20492049
20502050 If both arguments are given, *size * must not be less than ``len(init) ``.
20512051
@@ -2078,37 +2078,8 @@ Utility functions
20782078 This function creates a mutable unicode character buffer. The returned object is
20792079 a ctypes array of :class: `c_wchar `.
20802080
2081- If *size * is given (and not ``None ``), it must be an :class: `int `.
2082- It specifies the size of the returned array.
2083-
2084- If the *init * argument is given, it must be a string. It is used
2085- to initialize the array items. Bytes not initialized this way are
2086- set to zero (NUL).
2087-
2088- If *size * is not given (or if it is ``None ``), the buffer is made one byte
2089- larger than *init *, effectively adding a NUL termination byte.
2090-
2091- If both arguments are given, *size * must not be less than ``len(init) ``.
2092-
2093- .. warning ::
2094-
2095- If *size * is equal to ``len(init) ``, a NUL terminator is
2096- not added. Do not treat such a buffer as a C string.
2097-
2098- For example::
2099-
2100- >>> bytes(create_unicode_buffer(2))
2101- b'\x00\x00\x00\x00\x00\x00\x00\x00'
2102- >>> bytes(create_unicode_buffer('ab'))
2103- b'a\x00\x00\x00b\x00\x00\x00\x00\x00\x00\x00'
2104- >>> bytes(create_unicode_buffer('ab', 2))
2105- b'a\x00\x00\x00b\x00\x00\x00'
2106- >>> bytes(create_unicode_buffer('ab', 4))
2107- b'a\x00\x00\x00b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
2108- >>> bytes(create_unicode_buffer('abcdef', 2))
2109- Traceback (most recent call last):
2110- ...
2111- ValueError: string too long
2081+ The function takes the same arguments as :func: `~create_string_buffer ` except
2082+ *init * must be a string and *size * counts :class: `c_wchar `.
21122083
21132084 .. audit-event :: ctypes.create_unicode_buffer init,size ctypes.create_unicode_buffer
21142085
0 commit comments