Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 385b3686ff87da838af03b219540d704335f2bc6 authored by Larry Hastings on 24 July 2017, 02:40:13 UTC
Version bump & copyright year fixes for 3.5.4rc1.
Tip revision: 385b368
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