Weak reference objects have an optional callback argument, which is a function that is called when the original object is killed. This function is called only if the created weakref object is still alive. This fact isn't mentioned in the documentation - this patch mentions it.