From 90d8ff360bfb7be80640cc6437771a8acb57674a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 6 Jun 2023 15:06:16 +0200 Subject: [PATCH] gh-105373: PyObject_SetAttr(NULL) is no longer deprecated Remove the deprecation on the following functions: * PyObject_SetAttr(obj, attr_name, NULL) * PyObject_SetAttrString(obj, attr_name, NULL) * PySequence_SetItem(obj, i, NULL) * PySequence_SetSlice(obj, i1, i2, NULL) Deprecation added by commit ed82604e3f74682701afd974b93659fff044d352. --- Doc/c-api/object.rst | 9 ++++----- Doc/c-api/sequence.rst | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index a25ff244c9f07c..b56a342d99d1bc 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -81,9 +81,8 @@ Object Protocol return ``0`` on success. This is the equivalent of the Python statement ``o.attr_name = v``. - If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated - in favour of using :c:func:`PyObject_DelAttr`, but there are currently no - plans to remove it. + Delete the attribute named *attr_name* if *v* is ``NULL``. The function + :c:func:`PyObject_DelAttr` is preferred to delete an attribute. .. c:function:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v) @@ -93,8 +92,8 @@ Object Protocol return ``0`` on success. This is the equivalent of the Python statement ``o.attr_name = v``. - If *v* is ``NULL``, the attribute is deleted, but this feature is - deprecated in favour of using :c:func:`PyObject_DelAttrString`. + Delete the attribute named *attr_name* if *v* is ``NULL``. The function + :c:func:`PyObject_DelAttrString` is preferred to delete an attribute. .. c:function:: int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value) diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst index 402a3e5e09ff56..d8cf6f4efea272 100644 --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -69,8 +69,8 @@ Sequence Protocol 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, but this feature is - deprecated in favour of using :c:func:`PySequence_DelItem`. + Delete the *i*\ th element if *v* is ``NULL``. The function + :c:func:`PySequence_DelItem` is preferred to delete an element. .. c:function:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) @@ -84,6 +84,9 @@ Sequence Protocol Assign the sequence object *v* to the slice in sequence object *o* from *i1* to *i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``. + Delete the elements if *v* is ``NULL``. The function + :c:func:`PySequence_DelSlice` is preferred to delete elements. + .. c:function:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)