summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/abstract.rst33
-rw-r--r--Doc/c-api/index.rst6
-rw-r--r--Doc/c-api/newtypes.rst4
3 files changed, 20 insertions, 23 deletions
diff --git a/Doc/c-api/abstract.rst b/Doc/c-api/abstract.rst
index 4a78650..b3707fb 100644
--- a/Doc/c-api/abstract.rst
+++ b/Doc/c-api/abstract.rst
@@ -31,21 +31,14 @@ Object Protocol
instead of the :func:`repr`.
-.. cfunction:: int PyObject_HasAttrString(PyObject *o, const char *attr_name)
+.. cfunction:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name)
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This
is equivalent to the Python expression ``hasattr(o, attr_name)``. This function
always succeeds.
-.. cfunction:: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name)
-
- Retrieve an attribute named *attr_name* from object *o*. Returns the attribute
- value on success, or *NULL* on failure. This is the equivalent of the Python
- expression ``o.attr_name``.
-
-
-.. cfunction:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name)
+.. cfunction:: int PyObject_HasAttrString(PyObject *o, const char *attr_name)
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This
is equivalent to the Python expression ``hasattr(o, attr_name)``. This function
@@ -59,27 +52,34 @@ Object Protocol
expression ``o.attr_name``.
-.. cfunction:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v)
+.. cfunction:: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name)
+
+ Retrieve an attribute named *attr_name* from object *o*. Returns the attribute
+ value on success, or *NULL* on failure. This is the equivalent of the Python
+ expression ``o.attr_name``.
+
+
+.. cfunction:: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v)
Set the value of the attribute named *attr_name*, for object *o*, to the value
*v*. Returns ``-1`` on failure. This is the equivalent of the Python statement
``o.attr_name = v``.
-.. cfunction:: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v)
+.. cfunction:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v)
Set the value of the attribute named *attr_name*, for object *o*, to the value
*v*. Returns ``-1`` on failure. This is the equivalent of the Python statement
``o.attr_name = v``.
-.. cfunction:: int PyObject_DelAttrString(PyObject *o, const char *attr_name)
+.. cfunction:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name)
Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure.
- This is the equivalent of the Python statement: ``del o.attr_name``.
+ This is the equivalent of the Python statement ``del o.attr_name``.
-.. cfunction:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name)
+.. cfunction:: int PyObject_DelAttrString(PyObject *o, const char *attr_name)
Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure.
This is the equivalent of the Python statement ``del o.attr_name``.
@@ -327,7 +327,10 @@ is considered sufficient for this determination.
.. cfunction:: int PyObject_AsFileDescriptor(PyObject *o)
- Derives a file-descriptor from a Python object.
+ Derives a file descriptor from a Python object. If the object is an integer or
+ long integer, its value is returned. If not, the object's :meth:`fileno` method
+ is called if it exists; the method must return an integer or long integer, which
+ is returned as the file descriptor value. Returns ``-1`` on failure.
.. cfunction:: PyObject* PyObject_Dir(PyObject *o)
diff --git a/Doc/c-api/index.rst b/Doc/c-api/index.rst
index c643312..086b880 100644
--- a/Doc/c-api/index.rst
+++ b/Doc/c-api/index.rst
@@ -12,12 +12,6 @@ extension modules or embed Python. It is a companion to :ref:`extending-index`,
which describes the general principles of extension writing but does not
document the API functions in detail.
-.. warning::
-
- The current version of this document is somewhat incomplete. However, most of
- the important functions, types and structures are described.
-
-
.. toctree::
:maxdepth: 2
diff --git a/Doc/c-api/newtypes.rst b/Doc/c-api/newtypes.rst
index 1d4bfaa..2cf2099 100644
--- a/Doc/c-api/newtypes.rst
+++ b/Doc/c-api/newtypes.rst
@@ -618,8 +618,8 @@ type objects) *must* have the :attr:`ob_size` field.
objects which implement the mapping protocol. These fields are documented in
:ref:`mapping-structs`.
- The :attr:`tp_as_mapping` field is not inherited, but the contained fields are
- inherited individually.
+ The :attr:`tp_as_mapping` field is not inherited, but the contained fields
+ are inherited individually.
.. cmember:: hashfunc PyTypeObject.tp_hash