Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
pathlib.PurePath.match()
doesn't usefnmatch()
to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is specified in the pattern, it mustexactly match the corresponding drive/root in the path.
This results in the following:
>>>frompathlibimportPureWindowsPathasP>>>P('c:/b.py').match('*:/*.py')False>>>P('c:/b.py').match('c:*.py')True>>>P('c:/b.py').match('/*.py')True>>>P('//some/share/a.py').match('//*/*/*.py')False>>>P('//some/share/a.py').match('/*.py')True
All of these results are wrong IMO.