gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (#121534)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
sobolevn 2024-07-09 18:47:35 +03:00 committed by GitHub
parent 9ba2a4638d
commit 649d5b6d7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -39,7 +39,8 @@ Cell objects are not likely to be useful elsewhere.
.. c:function:: PyObject* PyCell_Get(PyObject *cell) .. c:function:: PyObject* PyCell_Get(PyObject *cell)
Return the contents of the cell *cell*. Return the contents of the cell *cell*, which can be ``NULL``.
If *cell* is not a cell object, returns ``NULL`` with an exception set.
.. c:function:: PyObject* PyCell_GET(PyObject *cell) .. c:function:: PyObject* PyCell_GET(PyObject *cell)
@ -52,8 +53,10 @@ Cell objects are not likely to be useful elsewhere.
Set the contents of the cell object *cell* to *value*. This releases the Set the contents of the cell object *cell* to *value*. This releases the
reference to any current content of the cell. *value* may be ``NULL``. *cell* reference to any current content of the cell. *value* may be ``NULL``. *cell*
must be non-``NULL``; if it is not a cell object, ``-1`` will be returned. On must be non-``NULL``.
success, ``0`` will be returned.
On success, return ``0``.
If *cell* is not a cell object, set an exception and return ``-1``.
.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value) .. c:function:: void PyCell_SET(PyObject *cell, PyObject *value)