mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #16730: Don't raise an exception in
importlib.machinery.FileFinder when the directory has become unreadable or a file. This brings semantics in line with Python 3.2 import. Reported and diagnosed by David Pritchard.
This commit is contained in:
parent
8762595ef3
commit
a9976b3e32
4 changed files with 1002 additions and 958 deletions
|
@ -1395,8 +1395,9 @@ class FileFinder:
|
|||
path = self.path
|
||||
try:
|
||||
contents = _os.listdir(path)
|
||||
except FileNotFoundError:
|
||||
# Directory has been removed since last import
|
||||
except (FileNotFoundError, PermissionError, NotADirectoryError):
|
||||
# Directory has either been removed, turned into a file, or made
|
||||
# unreadable.
|
||||
contents = []
|
||||
# We store two cached versions, to handle runtime changes of the
|
||||
# PYTHONCASEOK environment variable.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue