Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove os.fspath() call on curdir
  • Loading branch information
nineteendo committed Apr 6, 2024
commit a431caa6efabaa2c0962e238ad3341576150d7c2
10 changes: 6 additions & 4 deletions Lib/ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ def realpath(path, *, strict=False):

def relpath(path, start=None):
"""Return a relative version of a path"""

path = os.fspath(path)
if not path:
raise ValueError("no path specified")

if isinstance(path, bytes):
sep = b'\\'
curdir = b'.'
Expand All @@ -794,11 +798,9 @@ def relpath(path, start=None):

if start is None:
start = curdir
else:
start = os.fspath(start)

if not path:
raise ValueError("no path specified")

start = os.fspath(start)
try:
start_abs = abspath(normpath(start))
path_abs = abspath(normpath(path))
Expand Down