Armin Rigo | 5953bac | 2006-07-06 07:58:18 +0000 | [diff] [blame^] | 1 | """ |
2 | _PyType_Lookup() returns a borrowed reference. | ||||
3 | This attacks the call in dictobject.c. | ||||
4 | """ | ||||
5 | |||||
6 | class A(object): | ||||
7 | pass | ||||
8 | |||||
9 | class B(object): | ||||
10 | def __del__(self): | ||||
11 | print 'hi' | ||||
12 | del D.__missing__ | ||||
13 | |||||
14 | class D(dict): | ||||
15 | class __missing__: | ||||
16 | def __init__(self, *args): | ||||
17 | pass | ||||
18 | |||||
19 | |||||
20 | d = D() | ||||
21 | a = A() | ||||
22 | a.cycle = a | ||||
23 | a.other = B() | ||||
24 | del a | ||||
25 | |||||
26 | prev = None | ||||
27 | while 1: | ||||
28 | d[5] | ||||
29 | prev = (prev,) |