diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-01-09 23:52:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 23:52:15 (GMT) |
commit | beb80d11ec0ddaf00a97f8a38ec9eae68e07c28e (patch) | |
tree | 12fb69939ee1fc81d152f240c86bde0542b85545 /Python/symtable.c | |
parent | 57bdc6c30d2665c2760ff5a88487e57c8b3c397a (diff) | |
download | cpython-beb80d11ec0ddaf00a97f8a38ec9eae68e07c28e.zip cpython-beb80d11ec0ddaf00a97f8a38ec9eae68e07c28e.tar.gz cpython-beb80d11ec0ddaf00a97f8a38ec9eae68e07c28e.tar.bz2 |
GH-113528: Deoptimise `pathlib._abc.PurePathBase` (#113559)
Apply pathlib's normalization and performance tuning in `pathlib.PurePath`, but not `pathlib._abc.PurePathBase`.
With this change, the pathlib ABCs do not normalize away alternate path separators, empty segments, or dot segments. A single string given to the initialiser will round-trip by default, i.e. `str(PurePathBase(my_string)) == my_string`. Implementors can set their own path domain-specific normalization scheme by overriding `__str__()`
Eliminating path normalization makes maintaining and caching the path's parts and string representation both optional and not very useful, so this commit moves the `_drv`, `_root`, `_tail_cached` and `_str` slots from `PurePathBase` to `PurePath`. Only `_raw_paths` and `_resolving` slots remain in `PurePathBase`. This frees the ABCs from the burden of some of pathlib's hardest-to-understand code.
Diffstat (limited to 'Python/symtable.c')
0 files changed, 0 insertions, 0 deletions