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'):