Skip to content

Commit 751c2d0

Browse files
committed
gh-129813: Enhance PyBytesWriter documentation
Mention if functions overallocate or not.
1 parent 46f11b3 commit 751c2d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Doc/c-api/bytes.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Create, Finish, Discard
258258
259259
If *size* is greater than zero, allocate *size* bytes, and set the
260260
writer size to *size*. The caller is responsible to write *size*
261-
bytes using :c:func:`PyBytesWriter_GetData`.
261+
bytes using :c:func:`PyBytesWriter_GetData`. Do not overallocate.
262262
263263
On error, set an exception and return ``NULL``.
264264
@@ -348,7 +348,7 @@ Low-level API
348348
.. c:function:: int PyBytesWriter_Resize(PyBytesWriter *writer, Py_ssize_t size)
349349
350350
Resize the writer to *size* bytes. It can be used to enlarge or to
351-
shrink the writer.
351+
shrink the writer. Overallocate the writer.
352352
353353
Newly allocated bytes are left uninitialized.
354354
@@ -360,6 +360,7 @@ Low-level API
360360
.. c:function:: int PyBytesWriter_Grow(PyBytesWriter *writer, Py_ssize_t grow)
361361
362362
Resize the writer by adding *grow* bytes to the current writer size.
363+
Overallocate the writer.
363364
364365
Newly allocated bytes are left uninitialized.
365366

0 commit comments

Comments
 (0)