MCPcopy Index your code
hub / github.com/python/cpython / MyRef

Class MyRef

Lib/test/test_weakref.py:1077–1083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1075
1076 def test_subclass_refs(self):
1077 class MyRef(weakref.ref):
1078 def __init__(self, ob, callback=None, value=42):
1079 self.value = value
1080 super().__init__(ob, callback)
1081 def __call__(self):
1082 self.called = True
1083 return super().__call__()
1084 o = Object("foo")
1085 mr = MyRef(o, value=24)
1086 self.assertIs(mr(), o)

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…