Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a44783

Browse files
committed
Issue #28771: Update tp_get/setattr signature documentation
1 parent 898573a commit 7a44783

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/c-api/typeobj.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ type objects) *must* have the :attr:`ob_size` field.
199199

200200
This field is deprecated. When it is defined, it should point to a function
201201
that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string
202-
instead of a Python string object to give the attribute name. The signature is
203-
the same as for :c:func:`PyObject_GetAttrString`.
202+
instead of a Python string object to give the attribute name. The signature is ::
203+
204+
PyObject * tp_getattr(PyObject *o, char *attr_name);
204205

205206
This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype
206207
inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when
@@ -213,10 +214,11 @@ type objects) *must* have the :attr:`ob_size` field.
213214

214215
This field is deprecated. When it is defined, it should point to a function
215216
that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string
216-
instead of a Python string object to give the attribute name. The signature is
217-
the same as for :c:func:`PyObject_SetAttrString`, but setting
218-
*v* to *NULL* to delete an attribute must be supported.
217+
instead of a Python string object to give the attribute name. The signature is ::
218+
219+
PyObject * tp_setattr(PyObject *o, char *attr_name, PyObject *v);
219220

221+
The *v* argument is set to *NULL* to delete the attribute.
220222
This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype
221223
inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when
222224
the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*.

0 commit comments

Comments
 (0)