From 20cb4aca69daa33d733b309acbcd18ec0675d3be Mon Sep 17 00:00:00 2001 From: Tony Jinwoo Ahn Date: Wed, 11 Aug 2021 21:28:27 +0900 Subject: [PATCH] Fixed to use PathLike in imghdr.py --- Lib/imghdr.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/imghdr.py b/Lib/imghdr.py index c4a30094c..23156a80e 100644 --- a/Lib/imghdr.py +++ b/Lib/imghdr.py @@ -1,6 +1,6 @@ """Recognize image file formats based on their first few bytes.""" -#from os import PathLike +from os import PathLike __all__ = ["what"] @@ -14,8 +14,7 @@ def what(file, h=None): f = None try: if h is None: - # if isinstance(file, (str, PathLike)) - if isinstance(file, str): # FIXME(corona10): RustPython doesn't support PathLike yet. + if isinstance(file, (str, PathLike)): f = FileIO(file, 'rb') h = f.read(32) else: