]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 May 2022 00:39:43 +0000 (17:39 -0700)
committerGitHub <noreply@github.com>
Tue, 10 May 2022 00:39:43 +0000 (17:39 -0700)
commita51baec9ce0eae2b4db069a55daf8f03be3ab2f4
tree6dccfa9e580c358e85953e2723e54e217c25a9e1
parenta86229e82475e5e5e46327641a2be1628c7233ae
gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)

We could try to remedy this by taking a slice, but we then run into an issue where the empty string will match altsep on POSIX. That rabbit hole could keep getting deeper.

A proper fix for the original issue involves making pathlib's path normalisation more configurable - in this case we want to retain trailing slashes, but in other we might want to preserve `./` prefixes, or elide `../` segments when we're sure we won't encounter symlinks.

This reverts commit ea2f5bcda1a392804487e6883be89fbad38a01a5.
(cherry picked from commit dcdf250d2de1428f7d8b4e9ecf51d2fd8200e21a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Doc/library/pathlib.rst
Doc/whatsnew/3.11.rst
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2022-05-09-23-36-19.gh-issue-92550.qZ4AhU.rst [new file with mode: 0644]