Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: cf744da03be452ea69316838f08afbd4ba464be1 authored by Georg Brandl on 05 March 2011, 13:57:44 UTC
Close legacy-trunk branch.
Tip revision: cf744da
borrowed_ref_1.py
"""
_PyType_Lookup() returns a borrowed reference.
This attacks the call in dictobject.c.
"""

class A(object):
    pass

class B(object):
    def __del__(self):
        print 'hi'
        del D.__missing__

class D(dict):
    class __missing__:
        def __init__(self, *args):
            pass


d = D()
a = A()
a.cycle = a
a.other = B()
del a

prev = None
while 1:
    d[5]
    prev = (prev,)
back to top