Removed use of os.path.realpath

This commit is contained in:
Andrew Murray 2024-11-09 20:06:33 +11:00
parent ab496d04ce
commit 2303018ebf
3 changed files with 5 additions and 5 deletions

View File

@ -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")

View File

@ -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

View File

@ -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: