PageRenderTime 297ms CodeModel.GetById 118ms app.highlight 8ms RepoModel.GetById 166ms app.codeStats 0ms

/Lib/test/crashers/borrowed_ref_1.py

http://unladen-swallow.googlecode.com/
Python | 29 lines | 19 code | 6 blank | 4 comment | 1 complexity | 239d61737538e7ca4e82e68d11c09521 MD5 | raw file
 1"""
 2_PyType_Lookup() returns a borrowed reference.
 3This attacks the call in dictobject.c.
 4"""
 5
 6class A(object):
 7    pass
 8
 9class B(object):
10    def __del__(self):
11        print 'hi'
12        del D.__missing__
13
14class D(dict):
15    class __missing__:
16        def __init__(self, *args):
17            pass
18
19
20d = D()
21a = A()
22a.cycle = a
23a.other = B()
24del a
25
26prev = None
27while 1:
28    d[5]
29    prev = (prev,)