
From: "Jack Jansen" <Jack.Jansen@oratrix.nl>
In the discussion on my request for an ("O@", typeobject, void **) format for PyArg_Parse and Py_BuildValue MAL suggested (as MAL already explained, that we suggested by me) that I could get the same functionality by creating a type WrapperTypeObject, which would be a subtype of TypeObject with extra fields pointing to the _New() and _Convert() routines to convert Python objects from/to C pointers. This would be good enough for me, because then types wanting to participate in the wrapper protocol would subtype WrapperTypeObject in stead of TypeObject, and two global routines could return the _New and _Convert routines given the type object, and we wouldn't need yet another PyArg_Parse format specifier.
However, after digging high and low I haven't been able to deduce how I would then use this WrapperType in C as the type for my extension module objects. Are there any examples? If not, could someone who understands the new inheritance scheme give me some clues as to how to do this?
Currently (after quite some time) I have the impression that you cannot create a subtype of PyType_Type in C because PyType_Type ends in a variable sized array, at least not in this way: struct { PyTypeObject type; ...additional fields... } WrapperType_Type; Can someone confirm this? (I have to find out what to do with the tp_members slot, which seems to be correspond to the Python level __slots__ class variable) Thomas