diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-12-08 00:03:20 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-12-08 00:03:20 (GMT) |
commit | 45be8d67be0083c923ca31e4803de861177a2383 (patch) | |
tree | cadd706ffcae8663447629602d371fdd3c9e0509 /Doc/c-api/sequence.rst | |
parent | f17468961fc501a838657b63b4a724e9854a3b8d (diff) | |
download | cpython-45be8d67be0083c923ca31e4803de861177a2383.zip cpython-45be8d67be0083c923ca31e4803de861177a2383.tar.gz cpython-45be8d67be0083c923ca31e4803de861177a2383.tar.bz2 |
Issue #25701: Document C API functions that both set and delete objects
Also document that the separate functions that delete objects are preferred;
using PyObject_SetAttr(), _SetAttrString(), and PySequence_SetItem() to
delete is deprecated.
Diffstat (limited to 'Doc/c-api/sequence.rst')
-rw-r--r-- | Doc/c-api/sequence.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst index 5960db9..f1825f0 100644 --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -62,10 +62,14 @@ Sequence Protocol .. c:function:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) - Assign object *v* to the *i*\ th element of *o*. Returns ``-1`` on failure. This + Assign object *v* to the *i*\ th element of *o*. Raise an exception + and return ``-1`` on failure; return ``0`` on success. This is the equivalent of the Python statement ``o[i] = v``. This function *does not* steal a reference to *v*. + If *v* is *NULL*, the element is deleted, however this feature is + deprecated in favour of using :c:func:`PySequence_DelItem`. + .. c:function:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) |