summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2022-06-03 21:33:20 (GMT)
committerGitHub <noreply@github.com>2022-06-03 21:33:20 (GMT)
commitf32e6b48d12834ba3bde01ec21c14da33abd26d6 (patch)
tree97b0b34ae6d7bfd73a84d40e8e9a179a27352e9a /Python/compile.c
parent1a8a0ddb1c62ef9aff598e7e3e3a65cf35353932 (diff)
downloadcpython-f32e6b48d12834ba3bde01ec21c14da33abd26d6.zip
cpython-f32e6b48d12834ba3bde01ec21c14da33abd26d6.tar.gz
cpython-f32e6b48d12834ba3bde01ec21c14da33abd26d6.tar.bz2
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.
Diffstat (limited to 'Python/compile.c')
0 files changed, 0 insertions, 0 deletions