Lines Matching defs:callback

679         def callback(ignored):
683 WRs = [weakref.ref(c, callback) for c in Cs]
689 # the callback materialized a strong reference to an instance, but gc
695 # If the callback resurrected one of these guys, the instance
1063 # WZ is a weakref to Z with callback C
1081 # since the callback might tinker with objects that have already had
1084 callback = unittest.mock.Mock()
1096 a.wz = weakref.ref(a.y.value, callback)
1108 callback.assert_not_called()
1169 # Count the number of visits to each callback
1217 # Now, let our callback handle the Uncollectable instances
1308 c2wr = weakref.ref(c2) # no callback!
1311 def callback(ignored):
1314 # The callback gets associated with a wr on an object in generation 2.
1315 c0wr = weakref.ref(c0, callback)
1322 # global weakref to c2 (c2wr), but that weakref has no callback.
1324 # callback, and that callback references c2 via c2wr().
1326 # c0 has a wr with callback, which references c2wr
1334 # ^->c1 ^->c2 has a wr but no callback
1339 # that c2 has a callback-free weakref, and c1 doesn't even have a
1341 # the only object that has a weakref with a callback. gc clears c1
1344 # and c0's wr callback triggers. That in turn materializes a reference
1359 self.assertEqual(len(ouch), 1) # else the callback wasn't invoked
1361 # If the callback resurrected c2, the instance would be damaged,
1368 # callback to sneak in a resurrection of cyclic trash.
1384 c2wr = weakref.ref(c2) # no callback!
1391 # a global weakref to c2 (c2wr), but that weakref has no callback.
1402 # ^->c1 ^->c2 has a wr but no callback
1407 # that c2 has a callback-free weakref, and c1 doesn't even have a