Skip to content

Draft: ENH: Make dtypes immortal#30993

Open
eendebakpt wants to merge 3 commits into
numpy:mainfrom
eendebakpt:dtype_immortal_v2
Open

Draft: ENH: Make dtypes immortal#30993
eendebakpt wants to merge 3 commits into
numpy:mainfrom
eendebakpt:dtype_immortal_v2

Conversation

@eendebakpt

Copy link
Copy Markdown
Contributor

PR summary

Make the numpy standard dtypes immortal to improve performance.

[benchmarks to be added]

@ngoldbaum

AI Disclosure

Claude was used to identify the correct location for PyUnstable_SetImmortal to make the dtypes immortal.

@ngoldbaum

Copy link
Copy Markdown
Member

I think you need to add #include npy_pycompat.h to get the symbols from the capi-compat header available on older Python versions.

@eendebakpt

eendebakpt commented Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

@ngoldbaum

Copy link
Copy Markdown
Member

I guess it could make sense to make it a no-op on old versions. You'd have to check with victor though.

@seberg

seberg commented Mar 12, 2026

Copy link
Copy Markdown
Member

Oh, the other two places we have currently use #ifdef Py_GIL_DISABLED, but I think disabling on older versions (<3.13?) makes sense probably?

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.

3 participants