mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #22834: Have import suppress FileNotFoundError when the current
working directory no longer exists. Thanks to Martin Panter for the bug report.
This commit is contained in:
parent
8314690a26
commit
b6e2556d8f
7 changed files with 1043 additions and 1001 deletions
|
@ -1825,7 +1825,12 @@ class PathFinder:
|
|||
|
||||
"""
|
||||
if path == '':
|
||||
path = _os.getcwd()
|
||||
try:
|
||||
path = _os.getcwd()
|
||||
except FileNotFoundError:
|
||||
# Don't cache the failure as the cwd can easily change to
|
||||
# a valid directory later on.
|
||||
return None
|
||||
try:
|
||||
finder = sys.path_importer_cache[path]
|
||||
except KeyError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue