Eryk Sun <[email protected]> added the comment:
> Now a file that doesn't exist:
> >>> mike = Path("palin.jpg")
> >>> mike.resolve()
> WindowsPath('palin.jpg')
This is a bug in resolve(). It was fixed in 3.10+ by switching to
ntpath.realpath(). I don't remember why a fix for 3.9 was never applied. Work
on the PR may have stalled due to a minor disagreement.
> 'C:\Windows\..\Program Files' and '/usr/../bin' == relative path
No, a relative path depends on either the current working directory or, for a
symlink target, the path of the directory that contains the symlink.
In Windows, a rooted path such as r"\spam" is a relative path because it
depends on the drive of the current working directory. For example, if the
current working directory is r"Z:\eggs", then r"\spam" resolves to r"Z:\spam".
Also, a drive-relative paths such as "Z:spam" depends on the working directory
of the given drive. Windows supports a separate working directory for each
drive. For example, if the working directory of drive "Z:" is r"Z:\eggs", then
"Z:spam" resolves to r"Z:\eggs\spam".
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39090>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com