Skip to content

ENH: Adopt _umath_tests for Limited-API compliance - #32201

Merged
ngoldbaum merged 5 commits into
numpy:mainfrom
prathamhole14:umath_tests_limited_api
Aug 12, 2026
Merged

ngoldbaum merged 5 commits into
numpy:mainfrom
prathamhole14:umath_tests_limited_api

Conversation

@prathamhole14

Copy link
Copy Markdown
Member

PR summary

Related to: #31913

AI Disclosure

Finding places where changes are required.

@prathamhole14

Copy link
Copy Markdown
Member Author

Note: Ready for review!

@ngoldbaum
ngoldbaum marked this pull request as ready for review August 5, 2026 22:16
Comment thread numpy/_core/meson.build Resolved
@prathamhole14

Copy link
Copy Markdown
Member Author

Thanks for the reviews @ngoldbaum, I agree the comments were trivial therefore I have removed them, please have a look.

Comment thread numpy/_core/meson.build Outdated
Comment on lines 875 to 876
dependencies: [py_dep, np_core_dep]
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This library statically included into the _umath_tests module and also needs something like this (untested, suggested by an AI model):

Suggested change
dependencies: [py_dep, np_core_dep]
)
c_args: get_option('python.allow_limited_api') ? ['-DPy_LIMITED_API=0x030d0000'] : []
)

Since it's a static library the limited API macro doesn't flow down automatically. There's no equivalent of the py.extension_module limited_api argument for this multi_targets construction. But also maybe there should be? This construction is defined only in NumPy's fork of meson and hasn't landed upstream yet.

I don't know if you're going to come across more of this in the simd module.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for catching this, oops I wasn't aware limited_api doesn't propagate through link_with -- I have confirmed it's a real violation, also added py_limited_api_hex = '0x030d0000' since meson can't derive one from the other there's no int to hex conversion, and limited_api itself only accepts the X.Y decimal form.

@prathamhole14
prathamhole14 force-pushed the umath_tests_limited_api branch from 96edb3e to f3da436 Compare August 6, 2026 15:15
@prathamhole14

Copy link
Copy Markdown
Member Author

Failing tests are unrelated!

@ngoldbaum ngoldbaum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @prathamhole14!

@ngoldbaum
ngoldbaum merged commit 5b260d9 into numpy:main Aug 12, 2026
91 checks passed
@prathamhole14
prathamhole14 deleted the umath_tests_limited_api branch August 12, 2026 17:31
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.

2 participants