part 2 of Neil Schemenauer's GC patches:
This patch modifies the type structures of objects that
participate in GC. The object's tp_basicsize is increased when
GC is enabled. GC information is prefixed to the object to
maintain binary compatibility. GC objects also define the
tp_flag Py_TPFLAGS_GC.
diff --git a/Include/object.h b/Include/object.h
index e18e0e8..2250b7f 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -325,6 +325,13 @@
/* PySequenceMethods contains sq_contains */
#define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1)
+/* Objects which participate in garbage collection (see objimp.h) */
+#ifdef WITH_CYCLE_GC
+#define Py_TPFLAGS_GC (1L<<2)
+#else
+#define Py_TPFLAGS_GC 0
+#endif
+
#define Py_TPFLAGS_DEFAULT (Py_TPFLAGS_HAVE_GETCHARBUFFER | \
Py_TPFLAGS_HAVE_SEQUENCE_IN)
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 71dbb93..860030f 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -234,6 +234,12 @@
the 1st step is performed automatically for you, so in a C++ class
constructor you would start directly with PyObject_Init/InitVar. */
+
+
+#ifndef WITH_CYCLE_GC
+#define PyGC_INFO_SIZE 0
+#endif
+
#ifdef __cplusplus
}
#endif