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

Skip to content

Commit cfe1f3e

Browse files
committed
Clean up outside the loop
1 parent 0a738ae commit cfe1f3e

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
8000
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,15 @@ def _remove_proxy(self, proxy, *, _is_finalizing=sys.is_finalizing):
220220
for signal, proxies in list(self._func_cid_map.items()):
221221
try:
222222
del self.callbacks[signal][proxies[proxy]]
223+
break
223224
except KeyError:
224225
pass
225-
if len(self.callbacks[signal]) == 0:
226-
del self.callbacks[signal]
227-
del self._func_cid_map[signal]
226+
else:
227+
# Not found
228+
return
229+
if len(self.callbacks[signal]) == 0:
230+
del self.callbacks[signal]
231+
del self._func_cid_map[signal]
228232

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

0 commit comments

Comments
 (0)
0