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 barneygale
Recipients barneygale
Date 2021-06-04.21:21:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622841679.24.0.579072106292.issue44316@roundup.psfhosted.org>
In-reply-to
Content
>>> os.path.normpath('a/./b/../c//.')
'a/c'
>>> pathlib.Path('a/./b/../c//.')
PosixPath('a/b/../c')

pathlib takes care not to change the meaning of the path when normalising. That means preserving '..' entries, as these can't be simplified without resolving symlinks etc.

normpath(), on the other handle, /always/ eliminates '..' entries, which can change the meaning of the path.

We could add a new argument to `normpath()` and `abspath()` that leaves '..' entries intact. This was closed as "won't fix" back in bpo-2289, but I think it's worth re-considering.

This enhancement would be helpful for my longer-term work to make pathlib an OOP wrapper of os + os.path, rather than a parallel implementation.
History
Date User Action Args
2021-06-04 21:21:19barneygalesetrecipients: + barneygale
2021-06-04 21:21:19barneygalesetmessageid: <1622841679.24.0.579072106292.issue44316@roundup.psfhosted.org>
2021-06-04 21:21:19barneygalelinkissue44316 messages
2021-06-04 21:21:19barneygalecreate