diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-04-13 21:27:19 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-04-13 21:27:19 -0400 |
commit | ea7bc055b08fb442986e0735b1b5b325b0b51ecc (patch) | |
tree | 20c2b837c787daf7e95ece075e6544627b17625a /Lib/fnmatch.py | |
parent | c32365d2ce552d1d17279e30a564509235ffb1db (diff) | |
parent | c2c9c905706160bf34aea12f2348210aac3e0da2 (diff) | |
download | cpython-ea7bc055b08fb442986e0735b1b5b325b0b51ecc.tar.gz |
Merge #14399: corrected news item
Diffstat (limited to 'Lib/fnmatch.py')
-rw-r--r-- | Lib/fnmatch.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py index 726fbe556e..f446769b9f 100644 --- a/Lib/fnmatch.py +++ b/Lib/fnmatch.py @@ -35,9 +35,9 @@ def fnmatch(name, pat): pat = os.path.normcase(pat) return fnmatchcase(name, pat) -@functools.lru_cache(maxsize=250) -def _compile_pattern(pat, is_bytes=False): - if is_bytes: +@functools.lru_cache(maxsize=250, typed=True) +def _compile_pattern(pat): + if isinstance(pat, bytes): pat_str = str(pat, 'ISO-8859-1') res_str = translate(pat_str) res = bytes(res_str, 'ISO-8859-1') @@ -49,7 +49,7 @@ def filter(names, pat): """Return the subset of the list NAMES that match PAT.""" result = [] pat = os.path.normcase(pat) - match = _compile_pattern(pat, isinstance(pat, bytes)) + match = _compile_pattern(pat) if os.path is posixpath: # normcase on posix is NOP. Optimize it away from the loop. for name in names: @@ -67,7 +67,7 @@ def fnmatchcase(name, pat): This is a version of fnmatch() which doesn't case-normalize its arguments. """ - match = _compile_pattern(pat, isinstance(pat, bytes)) + match = _compile_pattern(pat) return match(name) is not None |