Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow path-like objects in fnmatch.fnmatchcase #123215

Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
@picnixz

Description

@picnixz
Issue body actions

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

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirPython modules in the Lib dirtype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.