[Python-checkins] cpython (merge default -> default): merge heads

senthil.kumaran python-checkins at python.org
Thu Oct 20 18:34:54 CEST 2011


http://hg.python.org/cpython/rev/d383af9d62d2
changeset:   73024:d383af9d62d2
parent:      73022:52a4e899966c
parent:      73020:8645f8a567f9
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Fri Oct 21 00:34:27 2011 +0800
summary:
  merge heads

files:
  Lib/fnmatch.py |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py
--- a/Lib/fnmatch.py
+++ b/Lib/fnmatch.py
@@ -35,9 +35,9 @@
     pat = os.path.normcase(pat)
     return fnmatchcase(name, pat)
 
- at functools.lru_cache(maxsize=250)
-def _compile_pattern(pat, is_bytes=False):
-    if is_bytes:
+ at 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 @@
     """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 @@
     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
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list