mdboom/matplotlib — comment on commit 9396ee786c83b6738f394e437122081ae10687f5
File:  line 0
By WeatherGod:

Don't have time to personally test it, but in terms of a sanity check, it looks reasonable. I still don't fully understand why the disconnect() logic doesn't clean out both dictionaries, but I haven't played with WeakKeyDictionary before, so maybe it isn't needed.