[Numpy-discussion] Reason behind C_ABI_VERSION so high

Stéfan van der Walt stefan@sun.ac...
Mon Oct 31 20:15:57 CDT 2011

Hi Sandro

On Mon, Oct 31, 2011 at 12:02 PM, Sandro Tosi <morph@debian.org> wrote:
> In order to do that, we'd like to use the C_API_VERSION and
> C_ABI_VERSION values; while for C_API_VERSION we can see it's a quite
> small value, with a clear history at
> ./numpy/core/code_generators/cversions.txt , we don't have quite clear
> why C_ABI_VERSION is such a high value and how it would be
> incremented.

Once, long long ago, the C_ABI_VERSION used to be called NPY_VERSION
(before we had the difference in notion between ABI and API version).
It then roughly matched the release number, e.g.:

commit 83d1d47bb8e5df4c9578a42f9f2ce8db408ccd00
Author: Travis Oliphant <oliphant@enthought.com>
Date:   Fri Jul 21 08:00:51 2006 +0000

    Change c-api to 1.0

diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/a
index f27450b..0033e58 100644
--- a/numpy/core/include/numpy/arrayobject.h
+++ b/numpy/core/include/numpy/arrayobject.h
@@ -36,7 +36,7 @@ extern "C" CONFUSE_EMACS
 #define NPY_SUCCEED 1

         /* Helpful to distinguish what is installed */
-#define NPY_VERSION 0x0009090D
+#define NPY_VERSION 0x01000000

After that, I suspect the number could not be made smaller for
backward compatibility.  But nowadays the ABI number is simply bumped
by one after every change, so for a good couple of million releases
you should be safe ignoring the "1" (but is the value really large
enough to cause problems?).


More information about the NumPy-Discussion mailing list