On 15 Apr 2020, at 03:39, Victor Stinner firstname.lastname@example.org wrote:
Le mar. 14 avr. 2020 à 18:25, Ronald Oussoren email@example.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: https://bugs.python.org/issue39573#msg366473
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: https://bugs.python.org/issue40170#msg366474
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.