]> granicus.if.org Git - python/commitdiff
Issue #13617: Document that the result PyUnicode_AsUnicode() and
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 18 Dec 2011 18:39:53 +0000 (19:39 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 18 Dec 2011 18:39:53 +0000 (19:39 +0100)
PyUnicode_AsWideChar() may contain embedded null characters.

Patch written by Arnaud Calmettes.

Doc/ACKS.txt
Doc/c-api/unicode.rst

index ec9efb0d61d47b62cfcacf9a9b874f3a762d4835..7507c6c6b76c448a297a0d5af947372d39c68d23 100644 (file)
@@ -33,6 +33,7 @@ docs@python.org), and we'll be glad to correct the problem.
    * Keith Briggs
    * Ian Bruntlett
    * Lee Busby
+   * Arnaud Calmettes
    * Lorenzo M. Catucci
    * Carl Cerecke
    * Mauro Cicognini
index 001192c948c6a0bee1a57a44c34dea11cfc9fc7d..57dd41dc2d72fade42b0a768c512aa5eb68eb6a0 100644 (file)
@@ -327,8 +327,11 @@ APIs:
 
 .. cfunction:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode)
 
-   Return a read-only pointer to the Unicode object's internal :ctype:`Py_UNICODE`
-   buffer, *NULL* if *unicode* is not a Unicode object.
+   Return a read-only pointer to the Unicode object's internal
+   :c:type:`Py_UNICODE` buffer, *NULL* if *unicode* is not a Unicode object.
+   Note that the resulting :c:type:`Py_UNICODE*` string may contain embedded
+   null characters, which would cause the string to be truncated when used in
+   most C functions.
 
 
 .. cfunction:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
@@ -391,7 +394,9 @@ wchar_t Support
    copied or -1 in case of an error.  Note that the resulting :ctype:`wchar_t`
    string may or may not be 0-terminated.  It is the responsibility of the caller
    to make sure that the :ctype:`wchar_t` string is 0-terminated in case this is
-   required by the application.
+   required by the application. Also, note that the :c:type:`wchar_t*` string
+   might contain null characters, which would cause the string to be truncated
+   when used with most C functions.
 
    .. versionchanged:: 2.5
       This function returned an :ctype:`int` type and used an :ctype:`int`