8000 gh-105373: PyObject_SetAttr(NULL) is no longer deprecated · vstinner/cpython@1a5b905 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a5b905

Browse files
committed
pythongh-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)
1 parent 0cb6b9b commit 1a5b905

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Doc/c-api/object.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ Object Protocol
8181
return ``0`` on success. This is the equivalent of the Python statement
8282
``o.attr_name = v``.
8383
84-
If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated
85-
in favour of using :c:func:`PyObject_DelAttr`, but there are currently no
86-
plans to remove it.
84+
Delete the attribute named *attr_name* if *v* is ``NULL``. The function
85+
:c:func:`PyObject_DelAttr` is preferred to delete an attribute.
8786
8887
8988
.. c:function:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v)
@@ -93,8 +92,8 @@ Object Protocol
9392
return ``0`` on success. This is the equivalent of the Python statement
9493
``o.attr_name = v``.
9594
96-
If *v* is ``NULL``, the attribute is deleted, but this feature is
97-
deprecated in favour of using :c:func:`PyObject_DelAttrString`.
95+
Delete the attribute named *attr_name* if *v* is ``NULL``. The function
96+
:c:func:`PyObject_DelAttrString` is preferred to delete an attribute.
9897
9998
10099
.. c:function:: int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value)

Doc/c-api/sequence.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Sequence Protocol
6969
is the equivalent of the Python statement ``o[i] = v``. This function *does
7070
not* steal a reference to *v*.
7171
72-
If *v* is ``NULL``, the element is deleted, but this feature is
73-
deprecated in favour of using :c:func:`PySequence_DelItem`.
72+
Delete the *i*\ th element if *v* is ``NULL``. The function
73+
:c:func:`PySequence_DelItem` is preferred to delete an element.
7474
7575
7676
.. c:function:: int PySequence_DelItem(PyObject *o, Py_ssize_t i)
@@ -84,6 +84,9 @@ Sequence Protocol
8484
Assign the sequence object *v* to the slice in sequence object *o* from *i1* to
8585
*i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``.
8686
87+
Delete the elements if *v* is ``NULL``. The function
88+
:c:func:`PySequence_DelSlice` is preferred to delete elements.
89+
8790
8891
.. c:function:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)
8992

0 commit comments

Comments
 (0)
0