]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331)
authorBarney Gale <barney.gale@gmail.com>
Mon, 3 Jul 2023 20:29:44 +0000 (21:29 +0100)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2023 20:29:44 +0000 (21:29 +0100)
commitb4efdf8cda8fbbd0ca53b457d5f6e46a59348caf
treea2dc7f0ed835a461a243fb3a1adc2855c40a8c9f
parente5862113dde7a66b08f1ece542a3cfaf0a3d9080
GH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331)

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.
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]