summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-03-02 13:35:37 (GMT)
committerGuido van Rossum <guido@python.org>2001-03-02 13:35:37 (GMT)
commitd1d053cc3f3c02595363015e0bee161e1aa4695c (patch)
treee7482a0fa600d90c6498bea718d56a313756ea96
parent53a79060bb998e5f1553ba24cdcf81dcfcb41491 (diff)
downloadcpython-d1d053cc3f3c02595363015e0bee161e1aa4695c.zip
cpython-d1d053cc3f3c02595363015e0bee161e1aa4695c.tar.gz
cpython-d1d053cc3f3c02595363015e0bee161e1aa4695c.tar.bz2
Patch by Itamar S.T. (SF#305470): add reset() method.
-rw-r--r--Lib/dircache.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/dircache.py b/Lib/dircache.py
index a999743..6171ff8 100644
--- a/Lib/dircache.py
+++ b/Lib/dircache.py
@@ -6,10 +6,15 @@ The annotate() routine appends slashes to directories."""
import os
-__all__ = ["listdir","opendir","annotate"]
+__all__ = ["listdir", "opendir", "annotate", "reset"]
cache = {}
+def reset():
+ """Reset the cache completely."""
+ global cache
+ cache = {}
+
def listdir(path):
"""List directory contents, using cache."""
try: