Skip to content

Commit fd3c510

Browse files
[3.15] gh-146353: Document PyBytesWriter_GetData pointer validity (GH-151418) (GH-151664)
gh-146353: Document `PyBytesWriter_GetData` pointer validity (GH-151418) (cherry picked from commit e99b319) Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
1 parent cafe39f commit fd3c510

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Doc/c-api/bytes.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,18 @@ Getters
384384
385385
Get the writer size.
386386
387+
The function does not invalidate pointers returned by
388+
:c:func:`PyBytesWriter_GetData`.
389+
387390
The function cannot fail.
388391
389392
.. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
390393
391394
Get the writer data: start of the internal buffer.
392395
393-
The pointer is valid until :c:func:`PyBytesWriter_Finish` or
394-
:c:func:`PyBytesWriter_Discard` is called on *writer*.
396+
The pointer remains valid until a :c:type:`PyBytesWriter` function other
397+
than :c:func:`PyBytesWriter_GetData` or :c:func:`PyBytesWriter_GetSize` is
398+
called on *writer*.
395399
396400
The function cannot fail.
397401

0 commit comments

Comments
 (0)