diff -r 1bf721567067 Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py Fri Mar 01 21:28:23 2013 +0200 +++ b/Lib/importlib/_bootstrap.py Fri Mar 01 16:57:55 2013 -0500 @@ -1344,13 +1344,12 @@ self._loaders = loaders # Base (directory) path self.path = path or '.' - self._path_mtime = -1 - self._path_cache = set() - self._relaxed_path_cache = set() + self.invalidate_caches() def invalidate_caches(self): """Invalidate the directory mtime.""" - self._path_mtime = -1 + self._path_cache = None + self._relaxed_path_cache = None find_module = _find_module_shim @@ -1359,13 +1358,8 @@ package portions. Returns (loader, list-of-portions).""" is_namespace = False tail_module = fullname.rpartition('.')[2] - try: - mtime = _os.stat(self.path).st_mtime - except OSError: - mtime = -1 - if mtime != self._path_mtime: + if self._path_cache is None: self._fill_cache() - self._path_mtime = mtime # tail_module keeps the original casing, for __file__ and friends if _relax_case(): cache = self._relaxed_path_cache