Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed use of os.path.realpath #8545

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2550,7 +2550,7 @@ def save(
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:
Expand All @@ -2559,7 +2559,7 @@ def save(
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()
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(
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
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def load_from_bytes(f: IO[bytes]) -> None:
)

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:
Expand Down
Loading