]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-146353: Document `PyBytesWriter_GetData` pointer validity (GH-151418)
authorHarjoth Khara <harjoth.khara@gmail.com>
Thu, 18 Jun 2026 16:55:06 +0000 (09:55 -0700)
committerGitHub <noreply@github.com>
Thu, 18 Jun 2026 16:55:06 +0000 (12:55 -0400)
Doc/c-api/bytes.rst

index f56bcd6333a37d31a3c24cc3041d27c0c8f11535..fa77d3d38ff89fd8763c2489f48ea5d27dfdbf1d 100644 (file)
@@ -384,14 +384,18 @@ Getters
 
    Get the writer size.
 
+   The function does not invalidate pointers returned by
+   :c:func:`PyBytesWriter_GetData`.
+
    The function cannot fail.
 
 .. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
 
    Get the writer data: start of the internal buffer.
 
-   The pointer is valid until :c:func:`PyBytesWriter_Finish` or
-   :c:func:`PyBytesWriter_Discard` is called on *writer*.
+   The pointer remains valid until a :c:type:`PyBytesWriter` function other
+   than :c:func:`PyBytesWriter_GetData` or :c:func:`PyBytesWriter_GetSize` is
+   called on *writer*.
 
    The function cannot fail.