Skip to content

MAINT: soft-deprecate PyArray_malloc/realloc/free in favor of PyMem_Raw APIs - #32334

Merged
charris merged 2 commits into
numpy:mainfrom
ngoldbaum:soft-deprecate-py-array-malloc
Aug 19, 2026
Merged

charris merged 2 commits into
numpy:mainfrom
ngoldbaum:soft-deprecate-py-array-malloc

Conversation

@ngoldbaum

Copy link
Copy Markdown
Member

PR summary

Followup from #32331 (ping @mattip).

From what I can tell, NPY_USE_PYMEM has been unconditionally defined to be 1 since August 19, 2006 (almost exactly 20 years ago!!) and the #else branch for when it's not defined has been dead code since then. See

#define NPY_USE_PYMEM 1
which was the last commit that changed this with the commit message "Fix white-space issues."

Let's soft-deprecate these but leave behind the define and aliases in case anyone is using them. Leaving these behind forever is free but managing a deprecation cycle isn't free.

AI Disclosure

An AI model did a code review pass

@ngoldbaum
ngoldbaum force-pushed the soft-deprecate-py-array-malloc branch from ff216f7 to 1785d72 Compare August 18, 2026 16:39

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

LGTM thanks

@charris
charris merged commit 10623fb into numpy:main Aug 19, 2026
112 of 115 checks passed
@charris

charris commented Aug 19, 2026

Copy link
Copy Markdown
Member

Thanks Nathan.

@ngoldbaum

Copy link
Copy Markdown
Member Author

Exactly 20 years later, thanks Chuck!!

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.

3 participants