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 Kevin.Norris, eryksun, pitrou, steve.dower, tim.golden, zach.ware
Date 2014-09-06.01:23:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409966616.76.0.383883377532.issue22299@psf.upfronthosting.co.za>
In-reply-to
Content
Maybe for an extended path it could try _getfinalpathname without the prefix. If it isn't a valid path or the result isn't the same as _getfinalpathname including the prefix, then skip calling _ext_to_normal. For example:

    def resolve(self, path):
        s = str(path)
        if not s:
            return os.getcwd()
        if _getfinalpathname is not None:
            prefix, t = self._split_extended_path(s)
            s = _getfinalpathname(s)
            if prefix:
                try:
                    if _getfinalpathname(t) != s:
                        return s
                except FileNotFoundError:
                    return s
            return self._ext_to_normal(s)        
        # Means fallback on absolute
        return None

The 'foo.' path in this issue would keep the prefix:

    >>> Path('//?/C:/foo.').resolve()
    WindowsPath('//?/C:/foo.')
    >>> Path('//?/UNC/server/C$/foo.').resolve()
    WindowsPath('//?/UNC/server/C$/foo.')

But regular paths would remove the prefix:

    >>> Path('//?/C:/bar').resolve()
    WindowsPath('C:/bar')
    >>> Path('//?/UNC/server/C$/bar').resolve() 
    WindowsPath('//server/C$/bar')

On a related note, _split_extended_path only looks for uppercase "UNC", which makes the above resolve method fail:

    >>> Path('//?/unc/server/C$/bar').resolve()
    WindowsPath('//?/UNC/server/C$/bar')
History
Date User Action Args
2014-09-06 01:23:36eryksunsetrecipients: + eryksun, pitrou, tim.golden, zach.ware, steve.dower, Kevin.Norris
2014-09-06 01:23:36eryksunsetmessageid: <1409966616.76.0.383883377532.issue22299@psf.upfronthosting.co.za>
2014-09-06 01:23:36eryksunlinkissue22299 messages
2014-09-06 01:23:35eryksuncreate