Home | History | Annotate | Download | only in crashers
      1 import gc
      2 
      3 thingy = object()
      4 class A(object):
      5     def f(self):
      6         return 1
      7     x = thingy
      8 
      9 r = gc.get_referrers(thingy)
     10 if "__module__" in r[0]:
     11     dct = r[0]
     12 else:
     13     dct = r[1]
     14 
     15 a = A()
     16 for i in range(10):
     17     a.f()
     18 dct["f"] = lambda self: 2
     19 
     20 print(a.f()) # should print 1
     21