8000 Clean up outside the loop · matplotlib/matplotlib@e7d6f12 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7d6f12

Browse files
committed
Clean up outside the loop
1 parent 5fe328e commit e7d6f12

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 7 additions & 3 deletions
8BA0
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,15 @@ def _remove_proxy(self, proxy, *, _is_finalizing=sys.is_finalizing):
219219
for signal, proxies in list(self._func_cid_map.items()):
220220
try:
221221
del self.callbacks[signal][proxies[proxy]]
222+
break
222223
except KeyError:
223224
pass
224-
if len(self.callbacks[signal]) == 0:
225-
del self.callbacks[signal]
226-
del self._func_cid_map[signal]
225+
else:
226+
# Not found
227+
return
228+
if len(self.callbacks[signal]) == 0:
229+
del self.callbacks[signal]
230+
del self._func_cid_map[signal]
227231

228232
def disconnect(self, cid):
229233
"""

0 commit comments

Comments
 (0)
0