| 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 |
| 9 |
class U(type, metaclass=T): |
| 10 |
pass |
| 11 |
U.__class__ = U |
| 12 |
del U |
| 13 |
gc.collect(); gc.collect(); gc.collect() |