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 9869fd7

Browse filesBrowse files
authored
Merge pull request #12416 from Kojoley/move-font-cache-rebuild-out-of-exception-handler
MNT: Move font cache rebuild out of exception handler
2 parents 9ffe5d5 + 8d6196e commit 9869fd7
Copy full SHA for 9869fd7

File tree

Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,17 +1356,20 @@ def _rebuild():
13561356
if _fmcache:
13571357
try:
13581358
fontManager = json_load(_fmcache)
1359+
except FileNotFoundError:
1360+
_log.debug("No font cache found %s", _fmcache)
1361+
except json.JSONDecodeError:
1362+
_log.warning("Font cache parsing failed %s", _fmcache)
1363+
else:
13591364
if (not hasattr(fontManager, '_version') or
13601365
fontManager._version != FontManager.__version__):
1361-
_rebuild()
1366+
_log.debug("Font cache needs rebuild (version mismatch)")
1367+
fontManager = None
13621368
else:
13631369
fontManager.default_size = None
13641370
_log.debug("Using fontManager instance from %s", _fmcache)
1365-
except TimeoutError:
1366-
raise
1367-
except Exception:
1368-
_rebuild()
1369-
else:
1371+
1372+
if fontManager is None:
13701373
_rebuild()
13711374

13721375
def findfont(prop, **kw):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.