ENH: Port numpy._core._simd to the Limited API - #32244
Open
prathamhole14 wants to merge 4 commits into
Open
Conversation
Replace the constructs that are not part of the Limited API: the static PyTypeObject and its PySequenceMethods become a PyType_Spec heap type, PyObject_New() becomes PyType_GenericAlloc(), and the fast sequence, tuple and list accessors become their checked equivalents. Add the libc includes that Python.h stops providing at Py_LIMITED_API >= 3.11. Nearly all of the module's Python-facing code is compiled into the _simd_mtargets archive, which the `limited_api:` kwarg does not reach, so add py_limited_api_args and pass it there.
python.allow_limited_api defaults to false, so this is a no-op for shipped wheels.
prathamhole14
force-pushed
the
simd_limited_api
branch
from
August 10, 2026 20:02
5b12c74 to
fc49097
Compare
prathamhole14
marked this pull request as ready for review
August 11, 2026 07:18
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR summary
Related to: #31913
I will update this soon with benchmarks. For now I will look how CI reacts, locally all the tests are passing for python
3.13linux build with limted api flag on.AI Disclosure
In researching and brainstorming specially the meson build part and for writing comments.