8000 Fix deprecation of backend_tools.ToolBase.destroy · matplotlib/matplotlib@7802d26 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7802d26

Browse files
committed
Fix deprecation of backend_tools.ToolBase.destroy
If not overridden, this will crash since it attempts to call `None()`.
1 parent 91f3465 commit 7802d26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backend_managers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ def remove_tool(self, name):
206206
"""
207207

208208
tool = self.get_tool(name)
209-
_api.deprecate_method_override(
209+
destroy = _api.deprecate_method_override(
210210
backend_tools.ToolBase.destroy, tool, since="3.6",
211-
alternative="tool_removed_event")()
211+
alternative="tool_removed_event")
212+
if destroy is not None:
213+
destroy()
212214

213215
# If it's a toggle tool and toggled, untoggle
214216
if getattr(tool, 'toggled', False):

0 commit comments

Comments
 (0)
0