[Patches] GC patch 3 and 4

Neil Schemenauer nascheme@enme.ucalgary.ca
Wed, 28 Jun 2000 10:50:56 -0600


On Wed, Jun 28, 2000 at 06:33:10PM +0200, Vladimir Marangozov wrote:
> BTW, what about the macro/function differenciation regarding the GC API?

I don't fully understand your question.  The GC API is as
follows:

  functions for objects:

    PyObject_GC_Init    - tell GC to track an object
    PyObject_GC_Fini    - tell GC to stop tracking an object

  macros for objects:

    PyObject_AS_GC      - convert from object pointer to GC pointer
    PyObject_FROM_GC    - convert from GC pointer to object pointer

  test macros:

    PyType_IS_GC        - true if objects of type have GC header
    PyObject_IS_GC      - true of object has GC header

The major problem I see with the current API is that PyObject_NEW
and PyObject_DEL are not symmetric.  When GC is enabled
PyObject_NEW returns an object pointer while PyObject_DEL takes a
GC pointer.

> Also, I don't think we need all the macros in objimpl.h. For instance,
> PyGC_INFO_UNSAFE seems unreasonable. Since it is a capitalized MACRO,
> it is supposed to be unsafe. Functions (or lowercased macros) are safe.

It probably can be removed now.  The safe version was for
debugging.

  Neil