On 15 Apr 2020, at 03:39, Victor Stinner <vstinner@python.org> wrote:

Hi Ronald,

Le mar. 14 avr. 2020 à 18:25, Ronald Oussoren <ronaldoussoren@mac.com> a écrit :
Making “PyObject” opaque will also affect the stable ABI because even types defined using the PyTypeSpec API embed a “PyObject” value in the structure defining the instance layout. It is easy enough to change this in a way that preserves source-code compatibility, but I’m  not sure it is possible to avoid breaking the stable ABI.

Oh, that's a good point. I tracked this issue at:

BTW. This will require growing the PyTypeSpec ABI a little, there are features you cannot implement using that API for example the buffer protocol.

I tracked this feature request at:

Another issue with making structures opaque is that this makes it at best harder to subclass builtin types in an extension while adding additional data fields to the subclass. This is a similar issue as the fragile base class issue that was fixed in Objective-C 2.0 by adding a level of indirection, and could probably be fixed in a similar way in Python.


Twitter / micro.blog: @ronaldoussoren
Blog: https://blog.ronaldoussoren.net/