Skip to content

Commit 3c38feb

Browse files
authored
gh-129813: Document that PyBytesWriter_GetData() cannot fail (#145900)
Document that PyBytesWriter_GetData() and PyBytesWriter_GetSize() getter functions cannot fail
1 parent 747ef70 commit 3c38feb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Doc/c-api/bytes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,17 @@ Getters
371371
372372
Get the writer size.
373373
374+
The function cannot fail.
375+
374376
.. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
375377
376378
Get the writer data: start of the internal buffer.
377379
378380
The pointer is valid until :c:func:`PyBytesWriter_Finish` or
379381
:c:func:`PyBytesWriter_Discard` is called on *writer*.
380382
383+
The function cannot fail.
384+
381385
382386
Low-level API
383387
^^^^^^^^^^^^^

Modules/binascii.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,9 +923,6 @@ binascii_a2b_ascii85_impl(PyObject *module, Py_buffer *data, int foldspaces,
923923
return NULL;
924924
}
925925
unsigned char *bin_data = PyBytesWriter_GetData(writer);
926-
if (bin_data == NULL) {
927-
goto error;
928-
}
929926

930927
uint32_t leftchar = 0;
931928
int group_pos = 0;

0 commit comments

Comments
 (0)