- New C API PyGC_Collect(), same as calling gc.collect().
- Call this in Py_Finalize().
- Expand the Misc/NEWS text on PY_LONG_LONG.
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 4fd4027..bb40b8f 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -980,8 +980,26 @@
#undef ADD_INT
}
+/* API to invoke gc.collect() from C */
+long
+PyGC_Collect(void)
+{
+ long n;
+
+ if (collecting)
+ n = 0; /* already collecting, don't do anything */
+ else {
+ collecting = 1;
+ n = collect(NUM_GENERATIONS - 1);
+ collecting = 0;
+ }
+
+ return n;
+}
+
/* for debugging */
-void _PyGC_Dump(PyGC_Head *g)
+void
+_PyGC_Dump(PyGC_Head *g)
{
_PyObject_Dump(FROM_GC(g));
}