From d87800a3c619a9cd051b5fac63a8486b48fb1c1c Mon Sep 17 00:00:00 2001 From: takanori-pskq Date: Thu, 15 Oct 2020 18:49:16 +0900 Subject: DOC: Add the entry for ``NPY_FEATURE_VERSION`` --- doc/source/reference/c-api/array.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/source/reference') diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index 637b6aaeb..ff8e911bf 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -3443,6 +3443,11 @@ Other constants variable is defined to guarantee the numpy/arrayobject.h header is being used). +.. c:macro:: NPY_FEATURE_VERSION + + The current version of the API. :c:data:`NPY_FEATURE_VERSION` changes + whenever the API changes (e.g. a function is added). + .. c:macro:: NPY_FALSE Defined as 0 for use with Bool. -- cgit v1.2.1 From 44b7698b9bba6b9212498e3659cede7d14a8b79a Mon Sep 17 00:00:00 2001 From: takanori-pskq Date: Thu, 22 Oct 2020 17:01:47 +0900 Subject: DOC: Fixup --- doc/source/reference/c-api/array.rst | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'doc/source/reference') diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index ff8e911bf..c737690d4 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -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,17 +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_FEATURE_VERSION - - The current version of the API. :c:data:`NPY_FEATURE_VERSION` changes - whenever the API changes (e.g. a function is added). - .. c:macro:: NPY_FALSE Defined as 0 for use with Bool. -- cgit v1.2.1