Skip to content

ENH: Migrate _multiarray_umath global variables to per-module state#31992

Draft
prathamhole14 wants to merge 1 commit into
numpy:mainfrom
prathamhole14:multiarray_module_state
Draft

ENH: Migrate _multiarray_umath global variables to per-module state#31992
prathamhole14 wants to merge 1 commit into
numpy:mainfrom
prathamhole14:multiarray_module_state

Conversation

@prathamhole14

Copy link
Copy Markdown
Contributor

PR summary

Planner for this migration is this #31930 (comment), but instead of multiple PRs there will be multiple commits in this PR itself.

Related to: #31930

Request to reviewers
I am planning on having 7 major commits in this PR, first commit is for infra, then next 5 for all structs and the 7th is for scattered globals.

So at each stage before I push next commit I would like to get an approval, so I can maintain clean history and this might also turn out useful in future if we want to go back/revert a particular stage or in debugging.

AI Disclosure

Used AI (claude and gemini) for researching and finding out what I have to work on and writing comments (intentionally asked it to make comments verbose for now -- so they can be used as trackers and later I will make them concise) other than that most of the code, logic, and architecture were written by me.

@prathamhole14 prathamhole14 force-pushed the multiarray_module_state branch from d9b01c3 to dd4e3ca Compare July 14, 2026 11:55
@mattip

mattip commented Jul 14, 2026

Copy link
Copy Markdown
Member

This looks correct to me so far. Do we have module teardown tests to make sure the GC paths are hit? You can try adding a temporary debug print statement in the m_traverse, m_clear, m_free functions and then run tests to make sure they are called somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants