Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 1 | # Reference cycles involving only the ob_type field are rather uncommon |
2 | # but possible. Inspired by SF bug 1469629. | ||||
3 | |||||
4 | import gc | ||||
5 | |||||
6 | def leak(): | ||||
7 | class T(type): | ||||
8 | pass | ||||
Guido van Rossum | 52cc1d8 | 2007-03-18 15:41:51 +0000 | [diff] [blame] | 9 | class U(type, metaclass=T): |
10 | pass | ||||
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 11 | U.__class__ = U |
12 | del U | ||||
13 | gc.collect(); gc.collect(); gc.collect() |