Skip to content

Commit 7042ab5

Browse files
authored
Merge pull request #12410 from meeseeksmachine/auto-backport-of-pr-12408-on-v3.0.x
Backport PR #12408 on branch v3.0.x (Don't crash on invalid registry font entries on Windows.)
2 parents 2765efb + 4646864 commit 7042ab5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/font_manager.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
199199
# Work around for https://bugs.python.org/issue25778, which
200200
# is fixed in Py>=3.6.1.
201201
direc = direc.split("\0", 1)[0]
202-
path = Path(directory, direc).resolve()
202+
try:
203+
path = Path(directory, direc).resolve()
204+
except (FileNotFoundError, RuntimeError):
205+
# Don't fail with invalid entries (FileNotFoundError is
206+
# only necessary on Py3.5).
207+
continue
203208
if path.suffix.lower() in fontext:
204209
items.add(str(path))
205210
except (OSError, MemoryError):

0 commit comments

Comments
 (0)