[New-bugs-announce] [issue25409] fnmatch.fnmatch normalizes slashes/backslashes on Windows

Florian Bruhin report at bugs.python.org
Thu Oct 15 08:04:51 CEST 2015


New submission from Florian Bruhin:

On Windows 8:

>>> fnmatch.fnmatch(r'foo\bar', 'foo/bar')
True
>>> fnmatch.fnmatchcase(r'foo\bar', 'foo/bar')
False

This is due to fnmatch calling os.path.normpath on the arguments (to get the case-sensitivity of the filesystem), which on Windows *also* happens to normalize / to \.

It's probably a bad idea to change the behaviour now, but I think at least this should be clarified in the docs.

----------
components: Library (Lib)
messages: 253030
nosy: The Compiler, eric.araujo, ezio.melotti, georg.brandl, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: fnmatch.fnmatch normalizes slashes/backslashes on Windows
type: behavior
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25409>
_______________________________________


More information about the New-bugs-announce mailing list