Issue 35488: pathlib Path.match does not behave as described (original) (raw)

Issue35488

Created on 2018-12-14 06:40 by anthony shaw, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_pathlib.py anthony shaw,2018-12-14 06:40
Pull Requests
URL Status Linked Edit
PR 11171 merged anthonypjshaw,2018-12-14 22:48
Messages (5)
msg331782 - (view) Author: anthony shaw (anthony shaw) Date: 2018-12-14 06:40
The documentation for pathlib PurePath.match(needle) says it accepts "glob-style pattern.". For an absolute path with a recursive pattern (**) it doesn't match correct for more than 1 directory level. All of the assertions in the attached file should pass. The issue I've seen is on the attached file. I'm using Python 3.7.1 and have also tested this against Python 3.6.6 with the pathlib module on PyPi. Absolute path glob'ing with a recursive pattern works as expected: entries = pathlib.Path('/var').glob('/var/**/*.log') Once this issue is confirmed, I would be happy to test & contribute a fix
msg331791 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-12-14 09:49
Is this similar to (See also ) and ? As I can see in Lib/test/test_pathlib.py there are also no tests for "**" and I think it's good to add one along with documenting it.
msg331878 - (view) Author: anthony shaw (anthony shaw) Date: 2018-12-14 22:49
Raised a PR for the test. Will look into doc PR
msg331890 - (view) Author: anthony shaw (anthony shaw) Date: 2018-12-15 09:02
Yes, this is similar to https://bugs.python.org/issue29249 In that issue, it suggests this feature is not supported, but that is neither documented, nor tested.
msg333117 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-01-06 20:31
New changeset 83da926b89daf80013ea966037c2c0e1e9d25c6b by Brett Cannon (Anthony Shaw) in branch 'master': bpo-35488: Add tests for ** glob matching in pathlib (GH-11171) https://github.com/python/cpython/commit/83da926b89daf80013ea966037c2c0e1e9d25c6b
History
Date User Action Args
2022-04-11 14:59:09 admin set github: 79669
2019-04-08 07:52:28 anthony shaw set status: open -> closedresolution: fixedstage: patch review -> resolved
2019-01-06 20:31:31 brett.cannon set messages: +
2018-12-17 21:49:59 brett.cannon set nosy: + brett.cannon
2018-12-15 09:02:45 anthony shaw set nosy: - serhiy.storchakamessages: +
2018-12-15 02:48:49 xtreak set nosy: + serhiy.storchaka
2018-12-14 22:49:13 anthony shaw set messages: +
2018-12-14 22:48:35 anthonypjshaw set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest10410>
2018-12-14 09:49:03 xtreak set messages: +
2018-12-14 08:53:01 xtreak set nosy: + xtreak
2018-12-14 06:40:23 anthony shaw create