diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-18 18:39:53 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-18 18:39:53 (GMT) |
commit | 28a545e234a4b542a0e8c88e6d217e5c99963a04 (patch) | |
tree | adc91c6ac95b6ef842226037f66fae0af82381f0 | |
parent | 3b3b1189ce250872d402194e1a12c5315034d847 (diff) | |
download | cpython-28a545e234a4b542a0e8c88e6d217e5c99963a04.zip cpython-28a545e234a4b542a0e8c88e6d217e5c99963a04.tar.gz cpython-28a545e234a4b542a0e8c88e6d217e5c99963a04.tar.bz2 |
Issue #13617: Document that the result PyUnicode_AsUnicode() and
PyUnicode_AsWideChar() may contain embedded null characters.
Patch written by Arnaud Calmettes.
-rw-r--r-- | Doc/ACKS.txt | 1 | ||||
-rw-r--r-- | Doc/c-api/unicode.rst | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index ec9efb0..7507c6c 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -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 diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 001192c..57dd41d 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -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` |