-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
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:
- Allow path-like objects in
fnmatch.filter
on POSIX platforms #123135 - Allow path-like objects in
fnmatch.fnmatchcase
#123215 (comment) - fnmatch: support pathlib typeshed#12522
Linked PRs
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir