Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-129813: Document that PyBytesWriter_GetData() cannot fail
Document that PyBytesWriter_GetData() and PyBytesWriter_GetSize()
getter functions cannot fail
  • Loading branch information
vstinner committed Mar 13, 2026
commit d484de8ae0999263050751c6c2e0dbd44a5e3651
4 changes: 4 additions & 0 deletions Doc/c-api/bytes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,17 @@ Getters

Get the writer size.

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 function cannot fail.


Low-level API
^^^^^^^^^^^^^
Expand Down
3 changes: 0 additions & 3 deletions Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,6 @@ binascii_a2b_ascii85_impl(PyObject *module, Py_buffer *data, int foldspaces,
return NULL;
}
unsigned char *bin_data = PyBytesWriter_GetData(writer);
if (bin_data == NULL) {
goto error;
}

uint32_t leftchar = 0;
int group_pos = 0;
Expand Down
Loading