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 Mike Davies, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-03-18.04:08:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552882082.98.0.472111191944.issue36334@roundup.psfhosted.org>
In-reply-to
Content
The drive is retained when a rooted path is joined to a drive-absolute or UNC-absolute path. This is documented behavior [1]:

    When several absolute paths are given, the last is taken as an
    anchor (mimicking os.path.join()’s behaviour):

        >>> PurePath('/etc', '/usr', 'lib64')
        PurePosixPath('/usr/lib64')
        >>> PureWindowsPath('c:/Windows', 'd:bar')
        PureWindowsPath('d:bar')

    However, in a Windows path, changing the local root doesn’t
    discard the previous drive setting:
    
        >>> PureWindowsPath('c:/Windows', '/Program Files')
        PureWindowsPath('c:/Program Files')

If you want to simply append directories to a path, use a relative path. For example:

    >>> Path('C:/Program Files') / Path('one/two/three.exe')
    WindowsPath('C:/Program Files/one/two/three.exe')

[1]: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath
History
Date User Action Args
2019-03-18 04:08:03eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, Mike Davies
2019-03-18 04:08:02eryksunsetmessageid: <1552882082.98.0.472111191944.issue36334@roundup.psfhosted.org>
2019-03-18 04:08:02eryksunlinkissue36334 messages
2019-03-18 04:08:02eryksuncreate