Skip to content
Snippets Groups Projects
Unverified Commit f32e6b48 authored by Barney Gale's avatar Barney Gale Committed by GitHub
Browse files

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.
parent 1a8a0ddb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment