]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
pathlib ABCs: add `_raw_path` property (#113976)
authorBarney Gale <barney.gale@gmail.com>
Sat, 13 Jan 2024 08:03:21 +0000 (08:03 +0000)
committerGitHub <noreply@github.com>
Sat, 13 Jan 2024 08:03:21 +0000 (08:03 +0000)
commitf20b151a1c49602282a0e80ffb92f68c28c04abd
treea6297cc95d132dda30a1c961cd608a2ffdbb81f4
parente4ff131e01184b68d868cfd241a03f8b7d2e0ff9
pathlib ABCs: add `_raw_path` property (#113976)

It's wrong for the `PurePathBase` methods to rely so much on `__str__()`.
Instead, they should treat the raw path(s) as opaque objects and leave the
details to `pathmod`.

This commit adds a `PurePathBase._raw_path` property and uses it through
many of the other ABC methods. These methods are all redefined in
`PurePath` and `Path`, so this has no effect on the public classes.
Lib/pathlib/__init__.py
Lib/pathlib/_abc.py