-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
As noted in PEP 703, C API functions returning borrowed references are problematic in the nogil build of Python, and new functions are available in Python 3.13 that return new references.
Three years ago @vstinner proposed vendoring pythoncapi-compat to replace npy3k_compat.h in #18713 and that was rejected.
Unlike that proposal, I don't want to expose pythoncapi-compat.h in the public numpy C API, instead I'd only like to use it internally, replacing the internal npy_pycompat.h header. That means concerns raised in that PR about requiring C99 or adding potentially problematic constructs to the numpy C API are moot.
We could also just copy/paste the definitions of the functions I need from the pythoncapi-compat.h header, but I thought it would be worth taking the project's temperature on adding it as a build-time dependency via a submodule like highway and pocketfft, since there will inevitably be other things we want in the future.