mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Handle os.PathLike in is_path
This commit is contained in:
parent
e3932b7dba
commit
945253672a
|
@ -230,7 +230,7 @@ class FreeTypeFont:
|
|||
)
|
||||
|
||||
if is_path(font):
|
||||
if isinstance(font, Path):
|
||||
if isinstance(font, os.PathLike):
|
||||
font = str(font)
|
||||
if sys.platform == "win32":
|
||||
font_bytes_path = font if isinstance(font, bytes) else font.encode()
|
||||
|
|
|
@ -8,7 +8,7 @@ from ._typing import StrOrBytesPath, TypeGuard
|
|||
|
||||
|
||||
def is_path(f: Any) -> TypeGuard[StrOrBytesPath]:
|
||||
return isinstance(f, (bytes, str, Path))
|
||||
return isinstance(f, (bytes, str, os.PathLike))
|
||||
|
||||
|
||||
def is_directory(f: Any) -> TypeGuard[bytes | str | Path]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user