[SciPy-user] [Numpy-discussion] [ANN] NumPy 0.9.6 released

David M. Cooke cookedm at physics.mcmaster.ca
Wed Mar 15 14:10:04 CST 2006


Travis Oliphant <oliphant at ee.byu.edu> writes:

> David M. Cooke wrote:
>
>>Only if it's a change that affects data structures or
>>previously-defined C API functions. Adding new C API functions
>>shouldn't affect old modules (because they're added on to the end of
>>the C API function list).
>>
>>
> I suppose we need to clarify when the NDARRAY_VERSION number needs a
> bump then, right.  Because if that gets bumped "unnecessarily" it will
> require re-compiles that aren't really necessary.
>
> -Travis

Here's things that'll make extensions using the old API
ABI-incompatible (application binary interface) with a newer one:

1) semantic changes of function arguments, or of a member of a struct.
   Changes in type are easier to spot, but it could be possible to
   have the same type but different meaning.

2) adding a member to a struct before any older ones. That will change the
   layout.

3) adding a function to the API before any older ones. This changes
   the layout of C API lookup table

Now, here's things that shouldn't change the ABI, and shouldn't
require a bump in NDARRAY_VERSION:

1) adding a function to the C API at the end of the lookup table. The
   old extension won't know it's there, and won't call it :-)

2) adding a member to a struct at the end, assuming that struct is
   always passed as a pointer, and assuming that it doesn't make the
   meaning of other members differ from what the extension module expects.

3) defining new macros, constants, etc.

I floated the idea a while ago of making the code generation step
smarter, along with import_array(), on how to get the C API lookup
table, by comparing what API functions the module wants with
per-function signatures, to what can be provided, etc. Haven't done
anything about it though. I'll see if I can think of something smarter
before 1.0.

If we're careful, we should be able to have different versions of the
API. import_array() could request, say, version 1.0 of the API, and
numpy could return that version (even if it's at 1.1).

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the Numpy-discussion mailing list