summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-10-05 07:57:16 -0400
committerNed Batchelder <ned@nedbatchelder.com>2017-10-05 07:57:16 -0400
commitfcfea15a10dbe010a8fd8fcd7b8ac1c37ae19678 (patch)
tree1fd8e87fdf11aa9103495188da33a41d6393a581 /coverage/files.py
parent14961ba86519ec98213f1315e2a94b9377db8778 (diff)
downloadpython-coveragepy-git-fcfea15a10dbe010a8fd8fcd7b8ac1c37ae19678.tar.gz
Python3.7 removed an unneeded backslash from fnmatch.translate
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/coverage/files.py b/coverage/files.py
index d2c2b894..d573f223 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -257,7 +257,9 @@ class FnmatchMatcher(object):
# of treating / and \ as equivalent. But on other platforms, we need to
# take care of that ourselves.
fnpats = (fnmatch.translate(p) for p in pats)
- fnpats = (p.replace(r"\/", r"[\\/]") for p in fnpats)
+ # 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)
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