Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: cd0dc16fdc60860bb69be020518234c0e897a1fb authored by Georg Brandl on 09 July 2011, 06:56:21 UTC
Bump version to 3.2.1.
Tip revision: cd0dc16
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