Issue 580107: Subclassing WeakValueDictionary impossib (original) (raw)

I'm trying to subclass weakref.WeakValueDictionary, so that it can send notifications when keys are removed.

I subclassed it and implemented a new delitem method, but unfortunately this is not called because WeakValueDictionary manipulates UserDict's data member directly (in __makeremove), without calling the delitem method.

Inspection of the sources shows that this is also the case in other methods as well...

I finally overrided __makeremovemethod and delitem ;-(