diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-10-05 07:57:16 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-10-05 07:57:16 -0400 |
commit | d06272c71a9e80f88b0b1f3fccf93772cb47e8f2 (patch) | |
tree | 7fa2a13304ba4877f8e8bac971db93f0c3831fbc /coverage/files.py | |
parent | a43b058d310acbf63b6f31da4e8ba14910e873c4 (diff) | |
download | python-coveragepy-d06272c71a9e80f88b0b1f3fccf93772cb47e8f2.tar.gz |
Python3.7 removed an unneeded backslash from fnmatch.translate
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/coverage/files.py b/coverage/files.py index d2c2b89..d573f22 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 |