]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-113437: Update documentation about PyUnicode_AsWideChar() function (GH-113455)
authorqqwqqw689 <114795525+qqwqqw689@users.noreply.github.com>
Tue, 13 Feb 2024 14:23:10 +0000 (22:23 +0800)
committerGitHub <noreply@github.com>
Tue, 13 Feb 2024 14:23:10 +0000 (15:23 +0100)
Doc/c-api/unicode.rst

index 5541eaa521803bc4ef3edada4b1169b9be23d889..666ffe89605c56fa9a0356f88c76539a7fbff3f7 100644 (file)
@@ -854,7 +854,12 @@ wchar_t Support
    Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*.  At most
    *size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
    null termination character).  Return the number of :c:type:`wchar_t` characters
-   copied or ``-1`` in case of an error.  Note that the resulting :c:expr:`wchar_t*`
+   copied or ``-1`` in case of an error.
+
+   When *wstr* is ``NULL``, instead return the *size* that would be required
+   to store all of *unicode* including a terminating null.
+
+   Note that the resulting :c:expr:`wchar_t*`
    string may or may not be null-terminated.  It is the responsibility of the caller
    to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
    required by the application. Also, note that the :c:expr:`wchar_t*` string