From 600dc276a46220193cb036743ffb3ec90ae1722d Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 23 Sep 2018 09:46:24 -0400 Subject: [PATCH] Backport PR #12213: Change win32InstalledFonts return value --- .../next_api_changes/2018-09-22-TH-win32InstalledFonts.rst | 5 +++++ lib/matplotlib/font_manager.py | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 doc/api/next_api_changes/2018-09-22-TH-win32InstalledFonts.rst diff --git a/doc/api/next_api_changes/2018-09-22-TH-win32InstalledFonts.rst b/doc/api/next_api_changes/2018-09-22-TH-win32InstalledFonts.rst new file mode 100644 index 000000000000..b806f8939a64 --- /dev/null +++ b/doc/api/next_api_changes/2018-09-22-TH-win32InstalledFonts.rst @@ -0,0 +1,5 @@ +matplotlib.font_manager.win32InstalledFonts return value +```````````````````````````````````````````````````````` + +`matplotlib.font_manager.win32InstalledFonts` returns an empty list instead +of None if no fonts are found. diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 8642d98581c6..6e081247b427 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -181,7 +181,6 @@ def win32InstalledFonts(directory=None, fontext='ttf'): filenames are returned by default, or AFM fonts if *fontext* == 'afm'. """ - import winreg if directory is None: @@ -203,10 +202,9 @@ def win32InstalledFonts(directory=None, fontext='ttf'): path = Path(directory, direc).resolve() if path.suffix.lower() in fontext: items.add(str(path)) - return list(items) except (OSError, MemoryError): continue - return None + return list(items) def OSXInstalledFonts(directories=None, fontext='ttf'):