[Numpy-discussion] Detecting C API mismatch (was Managing Python with NumPy and many external libraries on multiple Windows machines)

David Cournapeau david@ar.media.kyoto-u.ac...
Sun May 10 21:30:26 CDT 2009

Charles R Harris wrote:
> As you may have noticed, I really, really, don't like adding functions
> to the API ;)

Me neither :)

> Especially unneeded ones or ones that could be done at the python
> level. So I think the thing to do here is split the version into two
> 16 bit parts, then start with API version 0x000A and ABI version
> 0x0100 with the version number being 0x01000009.

I don't think you can do that: you will break a lot of code if you do
so. The currently built extensions will fail to load if the number is
any different with a new numpy. We need two independent numbers: one
which should prevents loading if the number is any different (the ABI
part) and one which should prevents loading if the compile-time number
is strictly greater than the runtime one. As the ABI part is already
checked in since at least numpy 1.2 and maybe lower, you can't change it

They could be part of the same underlying int if we did that from the
beginning, but that's not the case.
> There is nothing sacred about the numbers as long as they remain ordered.

if you change the number NPY_VERSION, you break every single extension
already built. With my scheme, you needs one more function, but you
don't break backward compatibility.



More information about the Numpy-discussion mailing list