From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 6 May 2022 09:56:55 +0000 (-0700) Subject: Document the lifetime of `PyUnicode_AsUTF8String` (GH-92325) X-Git-Tag: v3.9.13~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60407e8a1937cc4aaf6218a957743f62482257a1;p=thirdparty%2FPython%2Fcpython.git Document the lifetime of `PyUnicode_AsUTF8String` (GH-92325) The current wording implied this, but didn't state it explicitly. (cherry picked from commit 740da8d37a84638f4a8893bee3648f36fc6beb0f) Co-authored-by: Matt Wozniski --- diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index a6ae8ba13657..8bdcad63363b 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1110,7 +1110,8 @@ These are the UTF-8 codec APIs: This caches the UTF-8 representation of the string in the Unicode object, and subsequent calls will return a pointer to the same buffer. The caller is not - responsible for deallocating the buffer. + responsible for deallocating the buffer. The buffer is deallocated and + pointers to it become invalid when the Unicode object is garbage collected. .. versionadded:: 3.3