8000 Clean up both _func_cid_map and callbacks · matplotlib/matplotlib@1443178 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1443178

Browse files
committed
Clean up both _func_cid_map and callbacks
1 parent cfe1f3e commit 1443178

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,11 @@ def _remove_proxy(self, proxy, *, _is_finalizing=sys.is_finalizing):
217217
if _is_finalizing():
218218
# Weakrefs can't be properly torn down at that point anymore.
219219
return
220-
for signal, proxies in list(self._func_cid_map.items()):
221-
try:
222-
del self.callbacks[signal][proxies[proxy]]
220+
for signal, proxy_to_cid in list(self._func_cid_map.items()):
221+
cid = proxy_to_cid.pop(proxy, None)
222+
if cid is not None:
223+
del self.callbacks[signal][cid]
223224
break
224-
except KeyError:
225-
pass
226225
else:
227226
# Not found
228227
return

lib/matplotlib/tests/test_cbook.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ def test_callback_wrong_disconnect(self):
261261
# check we still have callbacks registered
262262
self.is_not_empty()
263263

264-
@pytest.mark.xfail(reason="must be fixed")
265264
def test_registration_on_non_empty_registry(self):
266265
# ensure we start with an empty registry
267266
self.is_empty()

0 commit comments

Comments
 (0)
0