From 2303018ebf751b7d6bc9d0e3d830cdd5f529a5b4 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 9 Nov 2024 20:06:33 +1100 Subject: [PATCH] Removed use of os.path.realpath --- src/PIL/Image.py | 6 +++--- src/PIL/ImageFile.py | 2 +- src/PIL/ImageFont.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 44270392c..9b76ce8bd 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2550,7 +2550,7 @@ class Image: filename: str | bytes = "" open_fp = False if is_path(fp): - filename = os.path.realpath(os.fspath(fp)) + filename = os.fspath(fp) open_fp = True elif fp == sys.stdout: try: @@ -2559,7 +2559,7 @@ class Image: pass if not filename and hasattr(fp, "name") and is_path(fp.name): # only set the name for metadata purposes - filename = os.path.realpath(os.fspath(fp.name)) + filename = os.fspath(fp.name) # may mutate self! self._ensure_mutable() @@ -3463,7 +3463,7 @@ def open( exclusive_fp = False filename: str | bytes = "" if is_path(fp): - filename = os.path.realpath(os.fspath(fp)) + filename = os.fspath(fp) if filename: fp = builtins.open(filename, "rb") diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index d69d84568..7f27d54dc 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -130,7 +130,7 @@ class ImageFile(Image.Image): if is_path(fp): # filename self.fp = open(fp, "rb") - self.filename = os.path.realpath(os.fspath(fp)) + self.filename = os.fspath(fp) self._exclusive_fp = True else: # stream diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index b694b817e..d8c265560 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -270,7 +270,7 @@ class FreeTypeFont: ) if is_path(font): - font = os.path.realpath(os.fspath(font)) + font = os.fspath(font) if sys.platform == "win32": font_bytes_path = font if isinstance(font, bytes) else font.encode() try: