Staging
v0.8.1
https://github.com/python/cpython
Raw File
Tip revision: a61d7f2490fd677343c28ac53e1b41cdb0e1d998 authored by Larry Hastings on 04 February 2018, 23:40:38 UTC
Version bump for 3.4.8.
Tip revision: a61d7f2
underlying_dict.py
import gc

thingy = object()
class A(object):
    def f(self):
        return 1
    x = thingy

r = gc.get_referrers(thingy)
if "__module__" in r[0]:
    dct = r[0]
else:
    dct = r[1]

a = A()
for i in range(10):
    a.f()
dct["f"] = lambda self: 2

print(a.f()) # should print 1
back to top