summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-03-16 04:13:56 (GMT)
committerLarry Hastings <larry@hastings.org>2014-03-16 04:13:56 (GMT)
commit3732ed24145c1ac77e99bcf85bccda3af095e696 (patch)
tree432a243f5f4d9720ec0cc202ee969f6175e450b7 /Doc/c-api
parentb6b6a6d587d267cbad490232d08faebd30fdb7e2 (diff)
downloadcpython-3732ed24145c1ac77e99bcf85bccda3af095e696.zip
cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.gz
cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.bz2
Merge in all documentation changes since branching 3.4.0rc1.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/arg.rst1
-rw-r--r--Doc/c-api/exceptions.rst8
-rw-r--r--Doc/c-api/init.rst1
-rw-r--r--Doc/c-api/module.rst2
-rw-r--r--Doc/c-api/object.rst6
-rw-r--r--Doc/c-api/tuple.rst8
-rw-r--r--Doc/c-api/typeobj.rst5
7 files changed, 20 insertions, 11 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index bf13eed..2f02241 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -45,6 +45,7 @@ in any early abort case).
Unless otherwise stated, buffers are not NUL-terminated.
.. note::
+
For all ``#`` variants of formats (``s#``, ``y#``, etc.), the type of
the length argument (int or :c:type:`Py_ssize_t`) is controlled by
defining the macro :c:macro:`PY_SSIZE_T_CLEAN` before including
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 989166f..7067448 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -525,11 +525,11 @@ Exception Objects
reference, as accessible from Python through :attr:`__cause__`.
-.. c:function:: void PyException_SetCause(PyObject *ex, PyObject *ctx)
+.. c:function:: void PyException_SetCause(PyObject *ex, PyObject *cause)
- Set the cause associated with the exception to *ctx*. Use *NULL* to clear
- it. There is no type check to make sure that *ctx* is either an exception
- instance or :const:`None`. This steals a reference to *ctx*.
+ Set the cause associated with the exception to *cause*. Use *NULL* to clear
+ it. There is no type check to make sure that *cause* is either an exception
+ instance or :const:`None`. This steals a reference to *cause*.
:attr:`__suppress_context__` is implicitly set to ``True`` by this function.
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 6439d7f..0587e15 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -582,6 +582,7 @@ code, or when embedding the Python interpreter:
.. index:: module: _thread
.. note::
+
When only the main thread exists, no GIL operations are needed. This is a
common situation (most Python programs do not use threads), and the lock
operations slow the interpreter down a bit. Therefore, the lock is not
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 26c4384..985a347 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -120,7 +120,7 @@ There are only a few functions special to module objects.
Return a pointer to the :c:type:`PyModuleDef` struct from which the module was
created, or *NULL* if the module wasn't created with
- :c:func:`PyModule_Create`.i
+ :c:func:`PyModule_Create`.
.. c:function:: PyObject* PyState_FindModule(PyModuleDef *def)
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index ad84301..509ca3f 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -357,9 +357,9 @@ attribute is considered sufficient for this determination.
.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
- Return an estimated length for the object *o*. First trying to return its
- actual length, then an estimate using ``__length_hint__``, and finally
- returning the default value. On error ``-1`` is returned. This is the
+ Return an estimated length for the object *o*. First try to return its
+ actual length, then an estimate using :meth:`~object.__length_hint__`, and
+ finally return the default value. On error return ``-1``. This is the
equivalent to the Python expression ``operator.length_hint(o, default)``.
.. versionadded:: 3.4
diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst
index 184affb..3922d50 100644
--- a/Doc/c-api/tuple.rst
+++ b/Doc/c-api/tuple.rst
@@ -129,6 +129,14 @@ type.
Initializes a struct sequence type *type* from *desc* in place.
+.. c:function:: int PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)
+
+ The same as ``PyStructSequence_InitType``, but returns ``0`` on success and ``-1`` on
+ failure.
+
+ .. versionadded:: 3.4
+
+
.. c:type:: PyStructSequence_Desc
Contains the meta information of a struct sequence type to create.
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 48b13e5..efd8574 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -205,9 +205,8 @@ type objects) *must* have the :attr:`ob_size` field.
bit currently defined is :const:`Py_PRINT_RAW`. When the :const:`Py_PRINT_RAW`
flag bit is set, the instance should be printed the same way as :c:member:`~PyTypeObject.tp_str`
would format it; when the :const:`Py_PRINT_RAW` flag bit is clear, the instance
- should be printed the same was as :c:member:`~PyTypeObject.tp_repr` would format it. It should
- return ``-1`` and set an exception condition when an error occurred during the
- comparison.
+ should be printed the same way as :c:member:`~PyTypeObject.tp_repr` would format it. It should
+ return ``-1`` and set an exception condition when an error occurs.
It is possible that the :c:member:`~PyTypeObject.tp_print` field will be deprecated. In any case,
it is recommended not to define :c:member:`~PyTypeObject.tp_print`, but instead to rely on