Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/deprecations/18003-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mathtext.Fonts.destroy
~~~~~~~~~~~~~~~~~~~~~~
... is deprecated, because Fonts do not create reference loops anyways.
8 changes: 7 additions & 1 deletion lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def __init__(self, default_font_prop, mathtext_backend):
self.mathtext_backend = mathtext_backend
self.used_characters = {}

@cbook.deprecated("3.4")
def destroy(self):
"""
Fix any cyclical references before the object is about
Expand Down Expand Up @@ -519,7 +520,11 @@ def get_results(self, box):
"""
result = self.mathtext_backend.get_results(
box, self.get_used_characters())
self.destroy()
if self.destroy != TruetypeFonts.destroy.__get__(self):
destroy = cbook._deprecate_method_override(
__class__.destroy, self, since="3.4")
if destroy:
destroy()
return result

def get_sized_alternatives_for_symbol(self, fontname, sym):
Expand Down Expand Up @@ -547,6 +552,7 @@ def __init__(self, default_font_prop, mathtext_backend):
self._fonts['default'] = default_font
self._fonts['regular'] = default_font

@cbook.deprecated("3.4")
def destroy(self):
self.glyphd = None
Fonts.destroy(self)
Expand Down