summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/init.rst2
-rw-r--r--Doc/c-api/number.rst4
-rw-r--r--Doc/c-api/object.rst20
-rw-r--r--Doc/c-api/structures.rst2
-rw-r--r--Doc/c-api/veryhigh.rst8
5 files changed, 32 insertions, 4 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 2d6b998..a6f8b9f 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -787,7 +787,7 @@ created.
Asynchronous Notifications
==========================
-A mechanism is provided to make asynchronous notifications to the the main
+A mechanism is provided to make asynchronous notifications to the main
interpreter thread. These notifications take the form of a function
pointer and a void argument.
diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst
index c8f6945..26e2dd4 100644
--- a/Doc/c-api/number.rst
+++ b/Doc/c-api/number.rst
@@ -264,8 +264,8 @@ Number Protocol
.. cfunction:: PyObject* PyNumber_ToBase(PyObject *n, int base)
- Returns the the integer *n* converted to *base* as a string with a base
- marker of ``'0b'``, ``'0o'``, or ``'0x'`` if appended applicable. When
+ Returns the integer *n* converted to *base* as a string with a base
+ marker of ``'0b'``, ``'0o'``, or ``'0x'`` if applicable. When
*base* is not 2, 8, 10, or 16, the format is ``'x#num'`` where x is the
base. If *n* is not an int object, it is converted with
:cfunc:`PyNumber_Index` first.
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index d9f29d1..b0700a1 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -42,6 +42,16 @@ Object Protocol
expression ``o.attr_name``.
+.. cfunction:: PyObject* PyObject_GenericGetAttr(PyObject *o, PyObject *name)
+
+ 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
+ descriptors don't. Otherwise, an :exc:`AttributeError` is raised.
+
+
.. 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
@@ -56,6 +66,16 @@ Object Protocol
``o.attr_name = v``.
+.. cfunction:: int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value)
+
+ Generic attribute setter function that is meant to be put into a type
+ 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.
+
+
.. cfunction:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name)
Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure.
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index fdbd806..489eaea 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -241,7 +241,7 @@ definition with the same method name.
T_OBJECT_EX PyObject \*
T_CHAR char
T_BYTE char
- T_UNBYTE unsigned char
+ T_UBYTE unsigned char
T_UINT unsigned int
T_USHORT unsigned short
T_ULONG unsigned long
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 62281aa..d716a46 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -38,6 +38,10 @@ the same library that the Python runtime is using.
interpreter exits due to an exception, or ``2`` if the parameter
list does not represent a valid Python command line.
+ Note that if an otherwise unhandled :exc:`SystemError` is raised, this
+ function will not return ``1``, but exit the process, as long as
+ ``Py_InspectFlag`` is not set.
+
.. cfunction:: int PyRun_AnyFile(FILE *fp, const char *filename)
@@ -80,6 +84,10 @@ the same library that the Python runtime is using.
there was an error, there is no way to get the exception information. For the
meaning of *flags*, see below.
+ Note that if an otherwise unhandled :exc:`SystemError` is raised, this
+ function will not return ``-1``, but exit the process, as long as
+ ``Py_InspectFlag`` is not set.
+
.. cfunction:: int PyRun_SimpleFile(FILE *fp, const char *filename)