diff -r 22b6b59c70e6 -r 94e671589c0e Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py Fri Mar 01 14:53:45 2013 +0200 +++ b/Lib/importlib/_bootstrap.py Fri Mar 01 12:57:08 2013 -0500 @@ -1344,13 +1344,13 @@ self._loaders = loaders # Base (directory) path self.path = path or '.' - self._path_mtime = -1 + self._path_stat = (-1, 0) self._path_cache = set() self._relaxed_path_cache = set() def invalidate_caches(self): - """Invalidate the directory mtime.""" - self._path_mtime = -1 + """Invalidate the directory mtime and nlink.""" + self._path_stat = (-1, 0) find_module = _find_module_shim @@ -1360,12 +1360,13 @@ is_namespace = False tail_module = fullname.rpartition('.')[2] try: - mtime = _os.stat(self.path).st_mtime + st = _os.stat(self.path) + path_stat = (st.st_mtime, st.st_nlink) except OSError: - mtime = -1 - if mtime != self._path_mtime: + path_stat = (-1, 0) + if path_stat != self._path_stat: self._fill_cache() - self._path_mtime = mtime + self._path_stat = path_stat # tail_module keeps the original casing, for __file__ and friends if _relax_case(): cache = self._relaxed_path_cache