diff --git a/python-stdlib/fnmatch/fnmatch.py b/python-stdlib/fnmatch/fnmatch.py index 71009afa2..2b42c3be4 100644 --- a/python-stdlib/fnmatch/fnmatch.py +++ b/python-stdlib/fnmatch/fnmatch.py @@ -27,8 +27,6 @@ def normcase(s): __all__ = ["filter", "fnmatch", "fnmatchcase", "translate"] -COMPAT = re.__name__ == "ure" - def fnmatch(name, pat): """Test whether FILENAME matches PATTERN. @@ -58,12 +56,18 @@ def _compile_pattern(pat): res = bytes(res_str, "ISO-8859-1") else: res = translate(pat) - if COMPAT: + + try: + ptn = re.compile(res) + except ValueError: + # re1.5 doesn't support all regex features if res.startswith("(?ms)"): res = res[5:] if res.endswith("\\Z"): res = res[:-2] + "$" - return re.compile(res).match + ptn = re.compile(res) + + return ptn.match def filter(names, pat): diff --git a/python-stdlib/fnmatch/manifest.py b/python-stdlib/fnmatch/manifest.py index 8f19bb8f4..f4318b374 100644 --- a/python-stdlib/fnmatch/manifest.py +++ b/python-stdlib/fnmatch/manifest.py @@ -1,3 +1,3 @@ -metadata(version="0.6.0") +metadata(version="0.6.1") module("fnmatch.py")