Skip to content

Backport PR #12408 on branch v3.0.x (Don't crash on invalid registry font entries on Windows.) #12410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
7 changes: 6 additions & 1 deletion lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
# Work around for https://bugs.python.org/issue25778, which
# is fixed in Py>=3.6.1.
direc = direc.split("\0", 1)[0]
path = Path(directory, direc).resolve()
try:
path = Path(directory, direc).resolve()
except (FileNotFoundError, RuntimeError):
# Don't fail with invalid entries (FileNotFoundError is
# only necessary on Py3.5).
continue
if path.suffix.lower() in fontext:
items.add(str(path))
except (OSError, MemoryError):
Expand Down