New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fnmatch does not follow Unix fnmatch functionality #75306
Comments
|
Currently, the fnmatch module in Python does not operate like the Unix equivalent command. This is especially the case with patterns such as Glob is not useful since glob is a special case that matches only with the current directory paths rather than the a general purpose filename pattern matcher. |
|
I don't believe there is an equivalent unix command. Are you referring to the fnmatch glibc function? Can you demonstrate the differences? I doubt we will change the functionality, but that would be the minimum starting point for a discussion. |
|
Looking at the fnmatch man page, it looks like there are option flags that some shells use that our fnmatch doesn't support. I'm not sure if supporting them is a good idea for us or not, but it is probably worth discussing. I suspect our fnmatch was implemented before gnu added those extensions. |
|
Hi David, |
|
That seems like a reasonable use case, but is fnmatch what git is using for this? If so, what is the feature set required? In any case, the existing functionality must remain as is for backward compatibility reasons, so this would either be a new function or keyword controlled optional behavior. (You will note that our fnmatch documentation specifically mentions treating / as a normal character.) |
Yup, as bitdancer mentions, this behaviour is documented, and has been documented for as long as fnmatch has been documented — since 1997 e76b7a8fcd7 Maybe your needs would be better met by something like https://github.com/cpburnz/python-pathspec |


Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: