]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] GH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331...
authorBarney Gale <barney.gale@gmail.com>
Tue, 4 Jul 2023 20:51:36 +0000 (21:51 +0100)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 20:51:36 +0000 (21:51 +0100)
commitd5ed72b696f2d26d85f3599abf0693545a1ac4e2
tree05fc68ffaa0f6672a77c2fdecb785820de756a64
parent930df7b07e774636ad200a62a7b4b56564f502b0
[3.12] GH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331) (GH-106372)

We match paths using the `_lines` attribute, which is derived from the
path's string representation. The bug arises because an empty path's string
representation is `'.'` (not `''`), which is matched by the `'*'` wildcard.
(cherry picked from commit b4efdf8cda8fbbd0ca53b457d5f6e46a59348caf)
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2023-07-02-10-56-41.gh-issue-106330.QSkIUH.rst [new file with mode: 0644]