[Python-Dev] Extending types in C - help needed
Jack Jansen
Jack.Jansen@oratrix.nl
Wed, 16 Jan 2002 23:56:23 +0100
In the discussion on my request for an ("O@", typeobject,
void **) format for PyArg_Parse and Py_BuildValue MAL suggested
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?
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution --
Emma Goldman -