Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve the documentation of fnmatch #123345

@picnixz

Description

@picnixz

The implementation of fnmatch.fnmatch calls os.path.normcase on both the filename and the pattern, also allowing path-like objects. On the other hand, fnmatch.filter call os.path.normcase to normalize the pattern as well as os.path.normcase on the filenames being iterated over, but only on non-POSIX platforms.

Following the discussion on #123215, we decided not to change the runtime behaviour (i.e. do not call os.fspath) but simply clarify the documentation. Inconsistencies remain between platforms where non-POSIX platforms will not get a TypeError if they use path-like objects in fnmatch.filter. We will also not document fnmatch.fnmatch as accepting path-like objects.

Related:

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions