Neil Schemenauer: GC enable(), disable(), isenabled() interface.
Small stylistic changes by VM:
- is_enabled() -> isenabled()
- static ... Py_<func> -> static ... gc_<func>
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 943f837..7f8e424 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -75,6 +75,11 @@
def test_all():
+
+ enabled = gc.isenabled()
+ gc.disable()
+ assert not gc.isenabled()
+
test_list()
test_dict()
test_tuple()
@@ -84,4 +89,11 @@
test_finalizer()
test_function()
+ # test gc.enable() even if GC is disabled by default
+ gc.enable()
+ assert gc.isenabled()
+ if not enabled:
+ gc.disable()
+
+
test_all()