mirror of
https://github.com/python/cpython.git
synced 2024-11-25 10:54:51 +08:00
Use KeyError.
This commit is contained in:
parent
5c5e829a5d
commit
4dedbf7197
@ -34,7 +34,7 @@ def cmp(f1, f2): # Compare two files, use the cache if possible.
|
||||
# cached signatures match
|
||||
return outcome
|
||||
# stale cached signature(s)
|
||||
except RuntimeError:
|
||||
except KeyError:
|
||||
# cache miss
|
||||
pass
|
||||
# really compare
|
||||
|
@ -13,7 +13,7 @@ def listdir(path): # List directory contents, using cache
|
||||
try:
|
||||
cached_mtime, list = cache[path]
|
||||
del cache[path]
|
||||
except RuntimeError:
|
||||
except KeyError:
|
||||
cached_mtime, list = -1, []
|
||||
try:
|
||||
mtime = posix.stat(path)[8]
|
||||
|
Loading…
Reference in New Issue
Block a user