def __int__(self): if self.aliased_object is None: raise weakref.ReferenceError("Proxy is no longer valid") return self.aliased_object.__int__()