[issue39573] [C API] Make PyObject an opaque structure in the limited C API

Ronald Oussoren report at bugs.python.org
Wed Apr 15 04:30:11 EDT 2020


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

The incompatibility mentioned in msg366473 is probably fixable by treating the PyObject header the same as the GC head structure. With some care this could mostly maintain binary compatibility by inserting some unused fields in PyObject_HEAD instead of the PyObject header when an extension targets a stable ABI version that has the PyObject header in-line.

This issue seems to be comparible to the "fragile instance variable" issue fixed in Objective-C 2.0, see <https://en.wikipedia.org/wiki/Objective-C#Non-fragile_instance_variables>.  That was fixed by adding a level of indirection when accessing member variables.

Something like that is probably necessary to be able to subclass builtin types (other than object itself) in an extension.

----------
nosy: +ronaldoussoren

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39573>
_______________________________________


More information about the Python-bugs-list mailing list