diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-01-09 23:04:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 23:04:14 (GMT) |
commit | cdca0ce0ad47604b7007229415817a7a152f7f9a (patch) | |
tree | 843651d436302f0e1fba686623e86bfb48dc51f5 /Lib/signal.py | |
parent | 5c7bd0e39839b27bc524e1790fe4936d987f384a (diff) | |
download | cpython-cdca0ce0ad47604b7007229415817a7a152f7f9a.zip cpython-cdca0ce0ad47604b7007229415817a7a152f7f9a.tar.gz cpython-cdca0ce0ad47604b7007229415817a7a152f7f9a.tar.bz2 |
GH-113528: Deoptimise `pathlib._abc.PurePathBase.relative_to()` (again) (#113882)
Restore full battle-tested implementations of `PurePath.[is_]relative_to()`. These were recently split up in 3375dfe and a15a773.
In `PurePathBase`, add entirely new implementations based on `_stack`, which itself calls `pathmod.split()` repeatedly to disassemble a path. These new implementations preserve features like trailing slashes where possible, while still observing that a `..` segment cannot be added to traverse an empty or `.` segment in *walk_up* mode. They do not rely on `parents` nor `__eq__()`, nor do they spin up temporary path objects.
Unfortunately calling `pathmod.relpath()` isn't an option, as it calls `abspath()` and in turn `os.getcwd()`, which is impure.
Diffstat (limited to 'Lib/signal.py')
0 files changed, 0 insertions, 0 deletions