Re: Deprecating direct access for struct fields exposed in the NumPy headers

Petr Viktorin via NumPy-Discussion <[email protected]> Tue, 3 Feb 2026 11:27:12 +0100
Newsgroups gmane.comp.python.numeric.general
Message-ID <[email protected]>
Hello! PEP 803 author here.

On 2/2/26 20:50, Nathan via NumPy-Discussion wrote:
> I'd like to update NumPy's C headers to deprecate directly accessing 
> structs that extend PyObject starting in the NumPy 2.5 C API.
[...]
> 
> The alternative is to only make these objects opaque during opaque 
> PyObject builds. I think I'd also like to deprecate access in internal 
> builds as I've done in my PR, since that forces us to actually use the 
> opaque object API and sets us on the path towards publicly deprecating 
> the old API.

I'd recommend this alternative. Some users won't benefit from this just 
yet; don't push it on them.
Note that avoiding PyObject internals currently comes with a performance 
penalty; things are at the “making it possible” stage, before “making it 
fast" or “polishing the API surface”.

_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]