inheriting from C types
Renzo Tomaselli
renzo.tomaselli at tecnotp.it
Tue Jul 16 14:05:59 EDT 2002
More information about the Python-list mailing list
Tue Jul 16 14:05:59 EDT 2002
- Previous message (by thread): inheriting from C types
- Next message (by thread): inheriting from C types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all, I'm looking at tips & tricks about inheriting from a C type. It works (almost), but from any derived class I'm not able to see any base class method. Say I implemented a C-type "ype" having Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE flags as well as tp_dealloc, tp_getattr slots. Allocators, constructors etc. are usual defaults. Now, in Python: import ype class k(ype.ype): pass k1 = k() I cannot see/invoke any method on base class ype from k1, while I can see all of them after direct creation of a base instance, say k2 = ype.ype(). I noticed that invoking any such method on k1 ends up in calling PyObject_GetAttr, which finds slot tp_getattro on the derived class k; this in turns calls PyObject_GenericGetAttr which fails. Almost surprisingly there is no attempt to climb the base class hierarchy. Any help is appreciated, Renzo Tomaselli
- Previous message (by thread): inheriting from C types
- Next message (by thread): inheriting from C types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list