Archived tweet #11374 from the @leastfixedpoint Twitter Archive@apenwarr # Others have suggested roughly this, but concretely:
class Leaked(Exception): pass
class Pinnable(object):
def __init__(self): self.__pinned = False
def __del__(self):
if self.__pinned: raise Leaked(self);
def pin(self, state = True): self.__pinned = state