[Python-checkins] r45389 - python/trunk/Lib/test/leakers/test_selftype.py

armin.rigo python-checkins at python.org
Fri Apr 14 16:58:30 CEST 2006


Author: armin.rigo
Date: Fri Apr 14 16:58:30 2006
New Revision: 45389

Added:
   python/trunk/Lib/test/leakers/test_selftype.py
Log:
Show case: reference cycles involving only the ob_type field are rather
uncommon but possible.  Inspired by SF bug 1469629.


Added: python/trunk/Lib/test/leakers/test_selftype.py
==============================================================================
--- (empty file)
+++ python/trunk/Lib/test/leakers/test_selftype.py	Fri Apr 14 16:58:30 2006
@@ -0,0 +1,13 @@
+# Reference cycles involving only the ob_type field are rather uncommon
+# but possible.  Inspired by SF bug 1469629.
+
+import gc
+
+def leak():
+    class T(type):
+        pass
+    class U(type):
+        __metaclass__ = T
+    U.__class__ = U
+    del U
+    gc.collect(); gc.collect(); gc.collect()


More information about the Python-checkins mailing list