{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4118","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4118/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4118/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4118/events","html_url":"https://github.com/matplotlib/matplotlib/pull/4118","id":57992748,"number":4118,"title":"CallbackRegistry fix","user":{"login":"OceanWolf","id":3758703,"avatar_url":"https://avatars.githubusercontent.com/u/3758703?v=3","gravatar_id":"","url":"https://api.github.com/users/OceanWolf","html_url":"https://github.com/OceanWolf","followers_url":"https://api.github.com/users/OceanWolf/followers","following_url":"https://api.github.com/users/OceanWolf/following{/other_user}","gists_url":"https://api.github.com/users/OceanWolf/gists{/gist_id}","starred_url":"https://api.github.com/users/OceanWolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OceanWolf/subscriptions","organizations_url":"https://api.github.com/users/OceanWolf/orgs","repos_url":"https://api.github.com/users/OceanWolf/repos","events_url":"https://api.github.com/users/OceanWolf/events{/privacy}","received_events_url":"https://api.github.com/users/OceanWolf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/needs_review","name":"needs_review","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18/labels","id":970105,"number":18,"title":"next point release","description":"Next minor release.","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":155,"closed_issues":28,"state":"open","created_at":"2015-02-07T21:22:30Z","updated_at":"2015-02-19T21:33:35Z","due_on":"2015-07-06T04:00:00Z","closed_at":null},"comments":11,"created_at":"2015-02-17T22:29:45Z","updated_at":"2015-02-20T03:56:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4118","html_url":"https://github.com/matplotlib/matplotlib/pull/4118","diff_url":"https://github.com/matplotlib/matplotlib/pull/4118.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/4118.patch"},"body":"As ``weakref.ref()`` does not accept bound or unbound functions, this means that the current ``if func in self._func_cid_map[s]:`` fails in these cases, and allows (s, func) pairs to get added many times.  ``_BoundMethodProxy`` fixed this problem for the ``CallbackRegistry.callbacks`` dict, but not for the ``CallbackRegistry._func_cid_map``, here we correct this.\r\n\r\nWhile researching the bug (and how to fix it), I discovered that ``weakref.ref()`` also supports a callback for when the weakref dies.  This seems like a much better way to do garbage collection then at present as ``CallbackRegistry`` only does GC only on the specific signal as it gets processed, so potentially quite late, this I fixed in the second commit."},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/75186013","html_url":"https://github.com/matplotlib/matplotlib/pull/4118#issuecomment-75186013","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4118","id":75186013,"user":{"login":"WeatherGod","id":291576,"avatar_url":"https://avatars.githubusercontent.com/u/291576?v=3","gravatar_id":"","url":"https://api.github.com/users/WeatherGod","html_url":"https://github.com/WeatherGod","followers_url":"https://api.github.com/users/WeatherGod/followers","following_url":"https://api.github.com/users/WeatherGod/following{/other_user}","gists_url":"https://api.github.com/users/WeatherGod/gists{/gist_id}","starred_url":"https://api.github.com/users/WeatherGod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeatherGod/subscriptions","organizations_url":"https://api.github.com/users/WeatherGod/orgs","repos_url":"https://api.github.com/users/WeatherGod/repos","events_url":"https://api.github.com/users/WeatherGod/events{/privacy}","received_events_url":"https://api.github.com/users/WeatherGod/received_events","type":"User","site_admin":false},"created_at":"2015-02-20T03:56:25Z","updated_at":"2015-02-20T03:56:25Z","body":"heh, indeed. Carry on, then!\n\nOn Thu, Feb 19, 2015 at 10:45 PM, OceanWolf <notifications@github.com>\nwrote:\n\n> @WeatherGod <https://github.com/WeatherGod> hehe, yes, I presumed that, I\n> even said so above in reply to your comment ;).\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/matplotlib/matplotlib/pull/4118#issuecomment-75185353>\n> .\n>\n"}}