Skip to content

ENH: Port _multiarray_tests to the Limited API - #32251

Merged
mattip merged 8 commits into
numpy:mainfrom
prathamhole14:multiarray_tests_limited_api
Sep 6, 2026
Merged

mattip merged 8 commits into
numpy:mainfrom
prathamhole14:multiarray_tests_limited_api

Conversation

@prathamhole14

Copy link
Copy Markdown
Member

PR summary

Related to: #31913

AI Disclosure

In understanding things, and finding places where changes are required and reviewing the changes.

@prathamhole14

Copy link
Copy Markdown
Member Author

I think this PR is good to be ready for review, but I would like to re-review it myself first!

@prathamhole14
prathamhole14 marked this pull request as ready for review August 16, 2026 06:14

@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.

This looks good but I noticed some issues in surrounding code and have one substantive suggestion.

Comment thread numpy/testing/print_coercion_tables.py Resolved
@prathamhole14

Copy link
Copy Markdown
Member Author

This PR is ready!

@mattip

mattip commented Sep 6, 2026

Copy link
Copy Markdown
Member

There are merge conflicts.

Py_SETREF(result, PyImport_Import(result));
PyObject *module = PyImport_Import(result);
Py_DECREF(result);
result = module;

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.

Why this change? Isn't the macro available on the limited API?

@prathamhole14 prathamhole14 Sep 6, 2026 •

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.

It is not Py_SETREF is only in cpython/object.h which object.h includes under #ifndef Py_LIMITED_API. Compiling it with -DPy_LIMITED_API=0x030d0000 gives implicit declaration of function 'Py_SETREF'.

Edit: see python/cpython#99574

@mattip
mattip merged commit 72b43bf into numpy:main Sep 6, 2026
91 checks passed
@mattip

mattip commented Sep 6, 2026

Copy link
Copy Markdown
Member

Thanks @prathamhole14

@prathamhole14
prathamhole14 deleted the multiarray_tests_limited_api branch September 6, 2026 10:22
@ngoldbaum

Copy link
Copy Markdown
Member

Also see capi-workgroup/decisions#110

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.

4 participants