gh-93156 - fix negative indexing into absolute `pathlib.PurePath().parents` (GH-93273)
When a `_PathParents` object has a drive or a root, the length of the object is *one less* than than the length of `self._parts`, which resulted in an off-by-one error when `path.parents[-n]` was fed through to `self._parts[:-n - 1]`. In particular, `path.parents[-1]` was a malformed path object with spooky properties. This is addressed by adding `len(self)` to negative indices.
B
Barney Gale committed
f32e6b48d12834ba3bde01ec21c14da33abd26d6
Parent: 1a8a0dd
Committed by GitHub <noreply@github.com>
on 6/3/2022, 9:33:20 PM