Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: ec2aed66177f8d74346d85ea42841ae538725d6e authored by Martin v. Löwis on 31 January 2010, 12:38:29 UTC
Prepare for 2.5.5.
Tip revision: ec2aed6
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