|
|
|
@ -208,12 +208,13 @@ type objects) *must* have the :attr:`ob_size` field. |
|
|
|
|
|
|
|
.. c:member:: setattrfunc PyTypeObject.tp_setattr |
|
|
|
|
|
|
|
An optional pointer to the set-attribute-string function. |
|
|
|
An optional pointer to the function for setting and deleting attributes. |
|
|
|
|
|
|
|
This field is deprecated. When it is defined, it should point to a function |
|
|
|
that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string |
|
|
|
instead of a Python string object to give the attribute name. The signature is |
|
|
|
the same as for :c:func:`PyObject_SetAttrString`. |
|
|
|
the same as for :c:func:`PyObject_SetAttrString`, but setting |
|
|
|
*v* to *NULL* to delete an attribute must be supported. |
|
|
|
|
|
|
|
This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype |
|
|
|
inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when |
|
|
|
@ -351,9 +352,10 @@ type objects) *must* have the :attr:`ob_size` field. |
|
|
|
|
|
|
|
.. c:member:: setattrofunc PyTypeObject.tp_setattro |
|
|
|
|
|
|
|
An optional pointer to the set-attribute function. |
|
|
|
An optional pointer to the function for setting and deleting attributes. |
|
|
|
|
|
|
|
The signature is the same as for :c:func:`PyObject_SetAttr`. It is usually |
|
|
|
The signature is the same as for :c:func:`PyObject_SetAttr`, but setting |
|
|
|
*v* to *NULL* to delete an attribute must be supported. It is usually |
|
|
|
convenient to set this field to :c:func:`PyObject_GenericSetAttr`, which |
|
|
|
implements the normal way of setting object attributes. |
|
|
|
|
|
|
|
@ -724,7 +726,7 @@ type objects) *must* have the :attr:`ob_size` field. |
|
|
|
typedef struct PyGetSetDef { |
|
|
|
char *name; /* attribute name */ |
|
|
|
getter get; /* C function to get the attribute */ |
|
|
|
setter set; /* C function to set the attribute */ |
|
|
|
setter set; /* C function to set or delete the attribute */ |
|
|
|
char *doc; /* optional doc string */ |
|
|
|
void *closure; /* optional additional data for getter and setter */ |
|
|
|
} PyGetSetDef; |
|
|
|
@ -775,12 +777,14 @@ type objects) *must* have the :attr:`ob_size` field. |
|
|
|
|
|
|
|
.. c:member:: descrsetfunc PyTypeObject.tp_descr_set |
|
|
|
|
|
|
|
An optional pointer to a "descriptor set" function. |
|
|
|
An optional pointer to a function for setting and deleting |
|
|
|
a descriptor's value. |
|
|
|
|
|
|
|
The function signature is :: |
|
|
|
|
|
|
|
int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value); |
|
|
|
|
|
|
|
The *value* argument is set to *NULL* to delete the value. |
|
|
|
This field is inherited by subtypes. |
|
|
|
|
|
|
|
.. XXX explain. |
|
|
|
@ -1171,9 +1175,11 @@ Mapping Object Structures |
|
|
|
|
|
|
|
.. c:member:: objobjargproc PyMappingMethods.mp_ass_subscript |
|
|
|
|
|
|
|
This function is used by :c:func:`PyObject_SetItem` and has the same |
|
|
|
signature. If this slot is *NULL*, the object does not support item |
|
|
|
assignment. |
|
|
|
This function is used by :c:func:`PyObject_SetItem` and |
|
|
|
:c:func:`PyObject_DelItem`. It has the same signature as |
|
|
|
:c:func:`PyObject_SetItem`, but *v* can also be set to *NULL* to delete |
|
|
|
an item. If this slot is *NULL*, the object does not support item |
|
|
|
assignment and deletion. |
|
|
|
|
|
|
|
|
|
|
|
.. _sequence-structs: |
|
|
|
@ -1222,7 +1228,7 @@ Sequence Object Structures |
|
|
|
|
|
|
|
This function is used by :c:func:`PySequence_SetItem` and has the same |
|
|
|
signature. This slot may be left to *NULL* if the object does not support |
|
|
|
item assignment. |
|
|
|
item assignment and deletion. |
|
|
|
|
|
|
|
.. c:member:: objobjproc PySequenceMethods.sq_contains |
|
|
|
|
|
|
|
|