summaryrefslogtreecommitdiffstats
path: root/Lib/test/leakers
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2006-04-14 14:58:30 (GMT)
committerArmin Rigo <arigo@tunes.org>2006-04-14 14:58:30 (GMT)
commit969ef7501c45eb4346d5c2992c9bdb69cc362438 (patch)
tree9327a0b87d6e7f03f548d6ad671c49c6768f9dda /Lib/test/leakers
parentdb4018f32040d752e324cead365f32da1e5c0dbe (diff)
downloadcpython-969ef7501c45eb4346d5c2992c9bdb69cc362438.zip
cpython-969ef7501c45eb4346d5c2992c9bdb69cc362438.tar.gz
cpython-969ef7501c45eb4346d5c2992c9bdb69cc362438.tar.bz2
Show case: reference cycles involving only the ob_type field are rather
uncommon but possible. Inspired by SF bug 1469629.
Diffstat (limited to 'Lib/test/leakers')
-rw-r--r--Lib/test/leakers/test_selftype.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/leakers/test_selftype.py b/Lib/test/leakers/test_selftype.py
new file mode 100644
index 0000000..4207c32
--- /dev/null
+++ b/Lib/test/leakers/test_selftype.py
@@ -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()