summaryrefslogtreecommitdiffstats
path: root/Lib/fnmatch.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-07-10 14:06:51 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-07-10 14:06:51 (GMT)
commit2ab02f0e16c8ce5242f2cdfb87bb2e98f79f5cfc (patch)
tree9fd1f3ceb18a05448c7fb4ac33d6127327e1f1d8 /Lib/fnmatch.py
parent94f071c7158e8751063a9692bc86a4122b0a717a (diff)
downloadcpython-2ab02f0e16c8ce5242f2cdfb87bb2e98f79f5cfc.zip
cpython-2ab02f0e16c8ce5242f2cdfb87bb2e98f79f5cfc.tar.gz
cpython-2ab02f0e16c8ce5242f2cdfb87bb2e98f79f5cfc.tar.bz2
Merged revisions 82766 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k Since 'purge' is an API change, modified it to be _purge for 2.x and deleted the doc update. ........ r82766 | r.david.murray | 2010-07-10 09:52:13 -0400 (Sat, 10 Jul 2010) | 5 lines Fix 'refleak' introduced by fnmatch cache purge tests. This introduces a 'purge' function for the fnmatch module analogous to the 'purge' function in the re module. ........
Diffstat (limited to 'Lib/fnmatch.py')
-rw-r--r--Lib/fnmatch.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py
index b1c37f5..ffe99b5 100644
--- a/Lib/fnmatch.py
+++ b/Lib/fnmatch.py
@@ -12,11 +12,15 @@ corresponding to PATTERN. (It does not compile it.)
import re
-__all__ = ["filter", "fnmatch","fnmatchcase","translate"]
+__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"]
_cache = {}
_MAXCACHE = 100
+def _purge():
+ """Clear the pattern cache"""
+ _cache.clear()
+
def fnmatch(name, pat):
"""Test whether FILENAME matches PATTERN.