As discussed in cython/cython#3573, the latest alpha versions of Cython 3.0 need updated NumPy declarations to allow users to set -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION. Currently, builds with that setting fail with NumPy 1.19.[01] because the numpy/__init__.pxd in NumPy overrides the more current one in Cython 3.0.
This PR adds an updated copy of numpy/__init__.pxd as numpy/__init__.cython-30.pxd to make Cython 3.0+ use it.
I first created a copy of the original __init__.pxd in order to make the changes visible in the diff. Two additional changes:
I'm not sure if we want the check_size ignore declarations in there. Cython has never had them (except for the one on ndarray), and that's what people were probably using, but … not my decision, I guess.
numpy.broadcast used to have struct fields defined in the NumPy version but not in the Cython version previously, so keeping them out is probably ok, but would now break backwards compatibility with NumPy 1.19.[01], where Cython 0.29.x already picks up the (old) NumPy version. Can't say how important that is for you. If at all, then they should rather be added as C-properties (as with the ndarray fields).
Whatever you decide, I'll follow in the Cython-3.0-side version of the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #16986.
As discussed in cython/cython#3573, the latest alpha versions of Cython 3.0 need updated NumPy declarations to allow users to set -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION. Currently, builds with that setting fail with NumPy 1.19.[01] because the numpy/__init__.pxd in NumPy overrides the more current one in Cython 3.0.
This PR adds an updated copy of numpy/__init__.pxd as numpy/__init__.cython-30.pxd to make Cython 3.0+ use it.
I first created a copy of the original __init__.pxd in order to make the changes visible in the diff. Two additional changes:
Whatever you decide, I'll follow in the Cython-3.0-side version of the file.