Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix numpy.i support for numpy API < 1.7. #7759

Merged
merged 1 commit into from Jun 18, 2016
Merged

Conversation

jjdmol
Copy link
Contributor

@jjdmol jjdmol commented Jun 18, 2016

numpy API < 1.7 does not support NPY_ARRAY_F_CONTIGUOUS.or PyArray_IS_F_CONTIGUOUS. Supporting old APIs is useful as users tend to ship modern numpy.i files to compile against possibly older numpy installations.

I tested this fix by searching for the introduction of both constants (numpy 1.7), and compiling against numpy 1.3 and 1.10. This ought to be more than sufficient for this simple change. Note that the code for <=1.7 is equal to what used to be there (actually until 1.9).

numpy API < 1.7 does not support NPY_ARRAY_F_CONTIGUOUS.or PyArray_IS_F_CONTIGUOUS. Supporting old APIs is useful as users tend to ship modern numpy.i files to compile against possibly older numpy installations.
@charris charris changed the title Fix numpy.i support for numpy API < 1.7. BUG: Fix numpy.i support for numpy API < 1.7. Jun 18, 2016
%#endif
%#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS((PyArrayObject*)a))
%#define array_is_native(a) (PyArray_ISNOTSWAPPED((PyArrayObject*)a))
%#define array_is_fortran(a) (PyArray_IS_F_CONTIGUOUS((PyArrayObject*)a))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyArray_IS_F_CONTIGUOUS is available in 1.6, it is 1.5 that misses it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, need coffee.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And nevermind the nevermind ;) PyArray_IS_F_CONTIGUOUS is in 1.6. Note that it is not quite the same as PyArray_ISFORTRAN.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

charris@fc [numpy.git ((v1.6.0))]$ grep -r PyArray_IS_F numpy/core/include/
numpy/core/include/numpy/ndarraytypes.h:#define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_F_CONTIGUOUS)

@charris
Copy link
Member

charris commented Jun 18, 2016

I'm a bit surprised that folks would still be using such ancient versions of Numpy, but perhaps that is driven by compatibility concerns with old code.

@charris charris merged commit 812ca6f into numpy:master Jun 18, 2016
@charris
Copy link
Member

charris commented Jun 18, 2016

Let's go ahead and put this in as is. I expect users of ancient numpy also expect ancient numpy.i ;) Thanks @jjdmol .

@jjdmol
Copy link
Contributor Author

jjdmol commented Jun 18, 2016

Thanks for including the patch! I still have an install target with numpy 1.3 to support, unfortunately. Hopefully they'll actually upgrade somewhere this year, but I'm not counting on it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants