mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Not backported because of behaviour change.
This commit is contained in:
parent
a64988c001
commit
c6bb6c0f8c
4 changed files with 8 additions and 10 deletions
|
@ -124,7 +124,8 @@ changes to your code:
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
|
|
||||||
\item Everything is all in the details!
|
\item dircache.listdir now passes exceptions to the caller,
|
||||||
|
instead of returning empty lists.
|
||||||
|
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,9 @@ def listdir(path):
|
||||||
del cache[path]
|
del cache[path]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cached_mtime, list = -1, []
|
cached_mtime, list = -1, []
|
||||||
try:
|
|
||||||
mtime = os.stat(path).st_mtime
|
mtime = os.stat(path).st_mtime
|
||||||
except os.error:
|
|
||||||
return []
|
|
||||||
if mtime != cached_mtime:
|
if mtime != cached_mtime:
|
||||||
try:
|
|
||||||
list = os.listdir(path)
|
list = os.listdir(path)
|
||||||
except os.error:
|
|
||||||
return []
|
|
||||||
list.sort()
|
list.sort()
|
||||||
cache[path] = mtime, list
|
cache[path] = mtime, list
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -56,7 +56,7 @@ class DircacheTests(unittest.TestCase):
|
||||||
self.assert_(dircache.listdir(self.tempdir) is entries)
|
self.assert_(dircache.listdir(self.tempdir) is entries)
|
||||||
|
|
||||||
## UNSUCCESSFUL CASES
|
## UNSUCCESSFUL CASES
|
||||||
self.assertEquals(dircache.listdir(self.tempdir+"_nonexistent"), [])
|
self.assertRaises(OSError, dircache.listdir, self.tempdir+"_nonexistent")
|
||||||
|
|
||||||
def test_annotate(self):
|
def test_annotate(self):
|
||||||
self.writeTemp("test2")
|
self.writeTemp("test2")
|
||||||
|
|
|
@ -40,6 +40,9 @@ Extension modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- dircache now passes exceptions to the caller, instead of returning
|
||||||
|
empty lists.
|
||||||
|
|
||||||
- The bsddb module and dbhash module now support the iterator and
|
- The bsddb module and dbhash module now support the iterator and
|
||||||
mapping protocols which make them more substitutable for dictionaries
|
mapping protocols which make them more substitutable for dictionaries
|
||||||
and shelves.
|
and shelves.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue