summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/dircache.py10
-rw-r--r--Lib/test/test_dircache.py2
2 files changed, 3 insertions, 9 deletions
diff --git a/Lib/dircache.py b/Lib/dircache.py
index e18c7c3..78ec7fe 100644
--- a/Lib/dircache.py
+++ b/Lib/dircache.py
@@ -22,15 +22,9 @@ def listdir(path):
del cache[path]
except KeyError:
cached_mtime, list = -1, []
- try:
- mtime = os.stat(path).st_mtime
- except os.error:
- return []
+ mtime = os.stat(path).st_mtime
if mtime != cached_mtime:
- try:
- list = os.listdir(path)
- except os.error:
- return []
+ list = os.listdir(path)
list.sort()
cache[path] = mtime, list
return list
diff --git a/Lib/test/test_dircache.py b/Lib/test/test_dircache.py
index 2ec89a2..52014e2 100644
--- a/Lib/test/test_dircache.py
+++ b/Lib/test/test_dircache.py
@@ -56,7 +56,7 @@ class DircacheTests(unittest.TestCase):
self.assert_(dircache.listdir(self.tempdir) is entries)
## UNSUCCESSFUL CASES
- self.assertEquals(dircache.listdir(self.tempdir+"_nonexistent"), [])
+ self.assertRaises(OSError, dircache.listdir, self.tempdir+"_nonexistent")
def test_annotate(self):
self.writeTemp("test2")