Skip to content

v0.5.10

Compare
Choose a tag to compare
@ionite34 ionite34 released this 07 Feb 06:57
· 113 commits to main since this release
bf1cc3a

Added

  • @impl now has optional bool keyword argument detach. If True, this will create a weak-reference finalizer for the method being implemented, and detach the method from the type when the method is garbage collected. If an original attribute exists, it will be restored during finalization, otherwise the attribute is deleted.
  • This can be useful in cases where methods are not safe to be kept through interpreter shutdown, like int.__hash__
from einspect import impl, orig

@impl(int, detach=True)
def __hash__(self):
	print("in hash", self)
    return orig(int).__hash__(self)

Full Changelog: v0.5.9...v0.5.10