From 39f3913b9d852662c38321366f383d2bdb5b2cea Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 1 Aug 2021 14:58:03 +1000 Subject: [PATCH] Convert font path on all platforms --- Tests/test_imagefont.py | 2 +- src/PIL/ImageFont.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 0e1554463..25966801f 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -1,10 +1,10 @@ import copy -from pathlib import Path import os import re import shutil import sys from io import BytesIO +from pathlib import Path import pytest from packaging.version import parse as parse_version diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index f4f47ff11..dcc8d9b8e 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -198,8 +198,8 @@ class FreeTypeFont: ) if isPath(font): + font = os.fspath(font) if sys.platform == "win32": - font = os.fspath(font) font_bytes_path = font if isinstance(font, bytes) else font.encode() try: font_bytes_path.decode("ascii")