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

MAINT: Introduce NPY_FEATURE_VERSION_STRING and report it in error #25948

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

seberg
Copy link
Member

@seberg seberg commented Mar 6, 2024

This improves the error message when the API version we compiled for mismatches to include the actual Python version. The big defines are a bit annoying, but not too bad.

This should also allow checking what a module is compiled for since:

strings build/numpy/_core/_rational_tests.cpython-310-darwin.so | grep "NumPy C-API"

Will report the error including the actual NumPy "python side" version we are compatible with (so that expanding that grep should be easy for extracting the interesting value.

Only modules which import NumPy will do this, I suspect that is well enough.

Closes gh-24861

This should also allow checking what a module is compiled for since:
```
strings build/numpy/_core/_rational_tests.cpython-310-darwin.so | grep "NumPy C-API"
```
Will report the error *including* the actual NumPy "python side" version
we are compatible with (so that expanding that grep should be easy for
extracting the interesting value.

Only modules which import NumPy will do this, I suspect that is well enough.
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Nice. LGTM, and I verified that the error string is present in extension modules built against NumPy. A bit hard to trigger right now, because building SciPy against this branch and then running against another numpy version runs into other incompatibilities before getting to this message. But I'm reasonably sure it's right, so let's get this in.

Thanks @seberg

@rgommers rgommers merged commit 41063ef into numpy:main Mar 7, 2024
64 checks passed
@rgommers rgommers added this to the 2.0.0 release milestone Mar 7, 2024
@jakirkham
Copy link
Contributor

Thank you both! 🙏

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

3 participants