Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc4aa081
Commit
cc4aa081
authored
Sep 20, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #707167: Pass dircache exceptions to the caller. Fixes #682813.
Not backported because of behaviour change.
parent
f2845619
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
10 deletions
+8
-10
Doc/whatsnew/whatsnew24.tex
Doc/whatsnew/whatsnew24.tex
+2
-1
Lib/dircache.py
Lib/dircache.py
+2
-8
Lib/test/test_dircache.py
Lib/test/test_dircache.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/whatsnew/whatsnew24.tex
View file @
cc4aa081
...
...
@@ -124,7 +124,8 @@ changes to your code:
\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}
...
...
Lib/dircache.py
View file @
cc4aa081
...
...
@@ -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
...
...
Lib/test/test_dircache.py
View file @
cc4aa081
...
...
@@ -56,7 +56,7 @@ class DircacheTests(unittest.TestCase):
self
.
assert_
(
dircache
.
listdir
(
self
.
tempdir
)
is
entries
)
## UNSUCCESSFUL CASES
self
.
assert
Equals
(
dircache
.
listdir
(
self
.
tempdir
+
"_nonexistent"
),
[]
)
self
.
assert
Raises
(
OSError
,
dircache
.
listdir
,
self
.
tempdir
+
"_nonexistent"
)
def
test_annotate
(
self
):
self
.
writeTemp
(
"test2"
)
...
...
Misc/NEWS
View file @
cc4aa081
...
...
@@ -40,6 +40,9 @@ Extension modules
Library
-------
-
dircache
now
passes
exceptions
to
the
caller
,
instead
of
returning
empty
lists
.
-
The
bsddb
module
and
dbhash
module
now
support
the
iterator
and
mapping
protocols
which
make
them
more
substitutable
for
dictionaries
and
shelves
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment