summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/reference/c-api')
-rw-r--r--doc/source/reference/c-api/array.rst36
-rw-r--r--doc/source/reference/c-api/types-and-structures.rst11
2 files changed, 27 insertions, 20 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst
index 637b6aaeb..ae39f980f 100644
--- a/doc/source/reference/c-api/array.rst
+++ b/doc/source/reference/c-api/array.rst
@@ -24,7 +24,7 @@ These macros access the :c:type:`PyArrayObject` structure members and are
defined in ``ndarraytypes.h``. The input argument, *arr*, can be any
:c:type:`PyObject *<PyObject>` that is directly interpretable as a
:c:type:`PyArrayObject *` (any instance of the :c:data:`PyArray_Type`
-and itssub-types).
+and its sub-types).
.. c:function:: int PyArray_NDIM(PyArrayObject *arr)
@@ -942,7 +942,7 @@ argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpret
Type represents one of the flexible array types ( :c:data:`NPY_STRING`,
:c:data:`NPY_UNICODE`, or :c:data:`NPY_VOID` ).
-.. c:function:: int PyDataType_ISUNSIZED(PyArray_Descr* descr):
+.. c:function:: int PyDataType_ISUNSIZED(PyArray_Descr* descr)
Type has no size information attached, and can be resized. Should only be
called on flexible dtypes. Types that are attached to an array will always
@@ -1335,7 +1335,7 @@ Special functions for NPY_OBJECT
locations in the structure with object data-types. No checking is
performed but *arr* must be of data-type :c:type:`NPY_OBJECT` and be
single-segment and uninitialized (no previous objects in
- position). Use :c:func:`PyArray_DECREF` (*arr*) if you need to
+ position). Use :c:func:`PyArray_XDECREF` (*arr*) if you need to
decrement all the items in the object array prior to calling this
function.
@@ -1354,7 +1354,7 @@ Special functions for NPY_OBJECT
strides, ordering, etc.) Sets the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag
and ``arr->base``, and set ``base`` to READONLY. Call
:c:func:`PyArray_ResolveWritebackIfCopy` before calling
- `Py_DECREF`` in order copy any changes back to ``base`` and
+ `Py_DECREF` in order copy any changes back to ``base`` and
reset the READONLY flag.
Returns 0 for success, -1 for failure.
@@ -3139,21 +3139,31 @@ calling the function). That's why several functions are provided to check for
numpy versions. The macros :c:data:`NPY_VERSION` and
:c:data:`NPY_FEATURE_VERSION` corresponds to the numpy version used to build the
extension, whereas the versions returned by the functions
-PyArray_GetNDArrayCVersion and PyArray_GetNDArrayCFeatureVersion corresponds to
-the runtime numpy's version.
+:c:func:`PyArray_GetNDArrayCVersion` and :c:func:`PyArray_GetNDArrayCFeatureVersion`
+corresponds to the runtime numpy's version.
The rules for ABI and API compatibilities can be summarized as follows:
- * Whenever :c:data:`NPY_VERSION` != PyArray_GetNDArrayCVersion, the
+ * Whenever :c:data:`NPY_VERSION` != ``PyArray_GetNDArrayCVersion()``, the
extension has to be recompiled (ABI incompatibility).
- * :c:data:`NPY_VERSION` == PyArray_GetNDArrayCVersion and
- :c:data:`NPY_FEATURE_VERSION` <= PyArray_GetNDArrayCFeatureVersion means
+ * :c:data:`NPY_VERSION` == ``PyArray_GetNDArrayCVersion()`` and
+ :c:data:`NPY_FEATURE_VERSION` <= ``PyArray_GetNDArrayCFeatureVersion()`` means
backward compatible changes.
ABI incompatibility is automatically detected in every numpy's version. API
incompatibility detection was added in numpy 1.4.0. If you want to supported
many different numpy versions with one extension binary, you have to build your
-extension with the lowest NPY_FEATURE_VERSION as possible.
+extension with the lowest :c:data:`NPY_FEATURE_VERSION` as possible.
+
+.. c:macro:: NPY_VERSION
+
+ The current version of the ndarray object (check to see if this
+ variable is defined to guarantee the ``numpy/arrayobject.h`` header is
+ being used).
+
+.. c:macro:: NPY_FEATURE_VERSION
+
+ The current version of the C-API.
.. c:function:: unsigned int PyArray_GetNDArrayCVersion(void)
@@ -3437,12 +3447,6 @@ Other constants
The maximum number of array arguments that can be used in functions.
-.. c:macro:: NPY_VERSION
-
- The current version of the ndarray object (check to see if this
- variable is defined to guarantee the numpy/arrayobject.h header is
- being used).
-
.. c:macro:: NPY_FALSE
Defined as 0 for use with Bool.
diff --git a/doc/source/reference/c-api/types-and-structures.rst b/doc/source/reference/c-api/types-and-structures.rst
index fb5753c02..8c1a679dc 100644
--- a/doc/source/reference/c-api/types-and-structures.rst
+++ b/doc/source/reference/c-api/types-and-structures.rst
@@ -69,6 +69,7 @@ PyArray_Type and PyArrayObject
typeobject.
.. c:type:: PyArrayObject
+ NPY_AO
The :c:type:`PyArrayObject` C-structure contains all of the required
information for an array. All instances of an ndarray (and its
@@ -77,7 +78,7 @@ PyArray_Type and PyArrayObject
provided macros. If you need a shorter name, then you can make use
of :c:type:`NPY_AO` (deprecated) which is defined to be equivalent to
:c:type:`PyArrayObject`. Direct access to the struct fields are
- deprecated. Use the `PyArray_*(arr)` form instead.
+ deprecated. Use the ``PyArray_*(arr)`` form instead.
.. code-block:: c
@@ -813,7 +814,9 @@ PyUFunc_Type and PyUFuncObject
.. c:member:: int identity
Either :c:data:`PyUFunc_One`, :c:data:`PyUFunc_Zero`,
- :c:data:`PyUFunc_None` or :c:data:`PyUFunc_AllOnes` to indicate
+ :c:data:`PyUFunc_MinusOne`, :c:data:`PyUFunc_None`,
+ :c:data:`PyUFunc_ReorderableNone`, or
+ :c:data:`PyUFunc_IdentityValue` to indicate
the identity for this operation. It is only used for a
reduce-like call on an empty array.
@@ -1216,8 +1219,8 @@ are ``Py{TYPE}ArrType_Type`` where ``{TYPE}`` can be
**Object**.
These type names are part of the C-API and can therefore be created in
-extension C-code. There is also a :c:data:`PyIntpArrType_Type` and a
-:c:data:`PyUIntpArrType_Type` that are simple substitutes for one of the
+extension C-code. There is also a ``PyIntpArrType_Type`` and a
+``PyUIntpArrType_Type`` that are simple substitutes for one of the
integer types that can hold a pointer on the platform. The structure
of these scalar objects is not exposed to C-code. The function
:c:func:`PyArray_ScalarAsCtype` (..) can be used to extract the C-type