-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed as not planned
Labels
performancePerformance or resource usagePerformance or resource usagestdlibPython modules in the Lib dirPython modules in the Lib dirtopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Return an unnormalized path from pathlib.PurePath.__fspath__()
Pitch
Code like open(Path('./README.txt'))
or Path('/home//barney').iterdir()
shouldn't require us to normalize the path in pathlib (e.g. remove .
segments, doubled slashes, etc), as OS APIs are perfectly happy with unnormalized paths.
We can improve the performance of most Path
methods, and the effective performance of passing a Path
object to any API that accepts os.PathLike
, by skipping normalization in __fspath__()
.
Prerequisites
Pathlib must not normalize paths on construction:
Pathlib's normalization must not change the meaning of paths:
Previous discussion
Linked PRs
Metadata
Metadata
Assignees
Labels
performancePerformance or resource usagePerformance or resource usagestdlibPython modules in the Lib dirPython modules in the Lib dirtopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement