Feature or enhancement
Proposal:
We should call os.fspath in fnmatchcase so that all functions in fnmatch have path-like support:
def fnmatchcase(name, pat):
"""Test whether FILENAME matches PATTERN, including case.
This is a version of fnmatch() which doesn't case-normalize
its arguments.
"""
match = _compile_pattern(pat)
- return match(name) is not None
+ return match(os.fspath(name)) is not None
See #123122 (comment) and #123122 (comment)
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
We should call
os.fspathinfnmatchcaseso that all functions infnmatchhave path-like support:def fnmatchcase(name, pat): """Test whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. """ match = _compile_pattern(pat) - return match(name) is not None + return match(os.fspath(name)) is not NoneSee #123122 (comment) and #123122 (comment)
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
fnmatch.fnmatchcase#123216