[Patches] GC patch 3 and 4

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Wed, 28 Jun 2000 05:10:22 +0200 (CEST)


Neil Schemenauer wrote:
> 
> [me] 
> > 2. Extension types that participate in GC
> > 
> >    The GC code implemented in the (core) object constructors is #ifdef'ed
> >    which is not what one is expected to do for custom extension types.
> >    If I am about to implement a GC'd type with the proposed patches, I'll
> >    have to #ifdef things which is not really what I want.
> 
> Aren't extensions supposed to use the function APIs?  If so,
> there are no ifdefs.

In the "normal" case, when using PyObject_New, yes. I was thinking about
the rare cases when PyObject_New needs to be inlined in the object
constructor of the extension type, as it is done in the core. In short,
we'd better provide the primitives hidden in PyObject_New/NewVar/Del for
the developer who needs to go at a lower level for customizing objects,
mallocs, etc.

For that matter, PyGC_TYPE_HAS_INFO(tp) has to be exported in the public
API too, probably under a more friendly name, like PyObject_Check_GC(op)
(or better) which would be defined as PyType_HAS_GC(op->ob_type), equivalent
to the PyGC_TYPE_HAS_INFO(op->ob_type) ...

But I agree that the above statement of mine doesn't reflect exactly
what I was thinking about :)

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252