diff options
author | sobolevn <mail@sobolevn.me> | 2024-08-03 21:55:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-03 21:55:47 (GMT) |
commit | 151934a324789c58cca9c7bbd6753d735454df5a (patch) | |
tree | 4e1de9d2d12428e0f9ea175c9e5914574a3e99a3 | |
parent | 95f5c89b545beaafad73f05a695742da3e90bc41 (diff) | |
download | cpython-151934a324789c58cca9c7bbd6753d735454df5a.zip cpython-151934a324789c58cca9c7bbd6753d735454df5a.tar.gz cpython-151934a324789c58cca9c7bbd6753d735454df5a.tar.bz2 |
gh-122623: Improve `c-api/bytearray.rst` with error handling info (#122624)
-rw-r--r-- | Doc/c-api/bytearray.rst | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/c-api/bytearray.rst b/Doc/c-api/bytearray.rst index 456f7d8..9045689 100644 --- a/Doc/c-api/bytearray.rst +++ b/Doc/c-api/bytearray.rst @@ -42,17 +42,22 @@ Direct API functions Return a new bytearray object from any object, *o*, that implements the :ref:`buffer protocol <bufferobjects>`. + On failure, return ``NULL`` with an exception set. + .. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len) - Create a new bytearray object from *string* and its length, *len*. On - failure, ``NULL`` is returned. + Create a new bytearray object from *string* and its length, *len*. + + On failure, return ``NULL`` with an exception set. .. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b) Concat bytearrays *a* and *b* and return a new bytearray with the result. + On failure, return ``NULL`` with an exception set. + .. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray) |