summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--coverage/files.py9
2 files changed, 5 insertions, 5 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 78bf0831..47e8e40a 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -95,4 +95,5 @@ Ted Wexler
Titus Brown
Ville Skyttä
Yury Selivanov
+Zac Hatfield-Dodds
Zooko Wilcox-O'Hearn
diff --git a/coverage/files.py b/coverage/files.py
index d573f223..346043da 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -260,12 +260,11 @@ class FnmatchMatcher(object):
# Python3.7 fnmatch translates "/" as "/", before that, it translates as "\/",
# so we have to deal with maybe a backslash.
fnpats = (re.sub(r"\\?/", r"[\\\\/]", p) for p in fnpats)
+ flags = 0
if env.WINDOWS:
- # Windows is also case-insensitive. BTW: the regex docs say that
- # flags like (?i) have to be at the beginning, but fnmatch puts
- # them at the end, and having two there seems to work fine.
- fnpats = (p + "(?i)" for p in fnpats)
- self.re = re.compile(join_regex(fnpats))
+ # Windows is also case-insensitive, so make the regex case-insensitive.
+ flags |= re.IGNORECASE
+ self.re = re.compile(join_regex(fnpats), flags=flags)
def __repr__(self):
return "<FnmatchMatcher %r>" % self.pats