From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 4 Aug 2024 12:09:22 +0000 (+0200) Subject: [3.13] gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624... X-Git-Tag: v3.13.0rc2~187 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9697b01fae9a8a1f0b2384caacaf51d82aad3180;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624) (#122658) gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624) (cherry picked from commit 151934a324789c58cca9c7bbd6753d735454df5a) Co-authored-by: sobolevn --- diff --git a/Doc/c-api/bytearray.rst b/Doc/c-api/bytearray.rst index 456f7d89bca0..9045689a6be5 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 `. + 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)