This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients 4-launchpad-kalvdans-no-ip-org, ChrisBarker, John-Hennig, Zim, brett.cannon, docs@python, eryksun, florisla, paul.moore, veky
Date 2022-04-01.14:09:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648822140.44.0.972281200899.issue39090@roundup.psfhosted.org>
In-reply-to
Content
> 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".
History
Date User Action Args
2022-04-01 14:09:00eryksunsetrecipients: + eryksun, brett.cannon, paul.moore, docs@python, veky, ChrisBarker, Zim, 4-launchpad-kalvdans-no-ip-org, florisla, John-Hennig
2022-04-01 14:09:00eryksunsetmessageid: <1648822140.44.0.972281200899.issue39090@roundup.psfhosted.org>
2022-04-01 14:09:00eryksunlinkissue39090 messages
2022-04-01 14:09:00eryksuncreate