mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue 19195: Improved cross-references in C API documentation.
This commit is contained in:
parent
91aaeac050
commit
0b68a2d675
10 changed files with 35 additions and 33 deletions
|
@ -60,8 +60,8 @@ Object Protocol
|
|||
Generic attribute getter function that is meant to be put into a type
|
||||
object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary
|
||||
of classes in the object's MRO as well as an attribute in the object's
|
||||
:attr:`__dict__` (if present). As outlined in :ref:`descriptors`, data
|
||||
descriptors take preference over instance attributes, while non-data
|
||||
:attr:`~object.__dict__` (if present). As outlined in :ref:`descriptors`,
|
||||
data descriptors take preference over instance attributes, while non-data
|
||||
descriptors don't. Otherwise, an :exc:`AttributeError` is raised.
|
||||
|
||||
|
||||
|
@ -85,8 +85,8 @@ Object Protocol
|
|||
object's ``tp_setattro`` slot. It looks for a data descriptor in the
|
||||
dictionary of classes in the object's MRO, and if found it takes preference
|
||||
over setting the attribute in the instance dictionary. Otherwise, the
|
||||
attribute is set in the object's :attr:`__dict__` (if present). Otherwise,
|
||||
an :exc:`AttributeError` is raised and ``-1`` is returned.
|
||||
attribute is set in the object's :attr:`~object.__dict__` (if present).
|
||||
Otherwise, an :exc:`AttributeError` is raised and ``-1`` is returned.
|
||||
|
||||
|
||||
.. c:function:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name)
|
||||
|
@ -189,9 +189,9 @@ Object Protocol
|
|||
be done against every entry in *cls*. The result will be ``1`` when at least one
|
||||
of the checks returns ``1``, otherwise it will be ``0``. If *inst* is not a
|
||||
class instance and *cls* is neither a type object, nor a class object, nor a
|
||||
tuple, *inst* must have a :attr:`__class__` attribute --- the class relationship
|
||||
of the value of that attribute with *cls* will be used to determine the result
|
||||
of this function.
|
||||
tuple, *inst* must have a :attr:`~instance.__class__` attribute --- the
|
||||
class relationship of the value of that attribute with *cls* will be used
|
||||
to determine the result of this function.
|
||||
|
||||
|
||||
Subclass determination is done in a fairly straightforward way, but includes a
|
||||
|
@ -201,9 +201,9 @@ of. If :class:`A` and :class:`B` are class objects, :class:`B` is a subclass of
|
|||
either is not a class object, a more general mechanism is used to determine the
|
||||
class relationship of the two objects. When testing if *B* is a subclass of
|
||||
*A*, if *A* is *B*, :c:func:`PyObject_IsSubclass` returns true. If *A* and *B*
|
||||
are different objects, *B*'s :attr:`__bases__` attribute is searched in a
|
||||
depth-first fashion for *A* --- the presence of the :attr:`__bases__` attribute
|
||||
is considered sufficient for this determination.
|
||||
are different objects, *B*'s :attr:`~class.__bases__` attribute is searched in
|
||||
a depth-first fashion for *A* --- the presence of the :attr:`~class.__bases__`
|
||||
attribute is considered sufficient for this determination.
|
||||
|
||||
|
||||
.. c:function:: int PyObject_IsSubclass(PyObject *derived, PyObject *cls)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue