diff options
author | Brett Cannon <brett@python.org> | 2014-11-21 17:19:28 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-11-21 17:19:28 (GMT) |
commit | b6e2556d8fbd172181aac09b7536563635af63a9 (patch) | |
tree | 07dcdf2a20ae9d8c82ead835491ab6ed7eccfaaa /Doc/reference | |
parent | 8314690a26501b3693f9a1f18c85f240a6c973bb (diff) | |
download | cpython-b6e2556d8fbd172181aac09b7536563635af63a9.zip cpython-b6e2556d8fbd172181aac09b7536563635af63a9.tar.gz cpython-b6e2556d8fbd172181aac09b7536563635af63a9.tar.bz2 |
Issue #22834: Have import suppress FileNotFoundError when the current
working directory no longer exists.
Thanks to Martin Panter for the bug report.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/import.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index dbb2e0a..99b77be 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -754,6 +754,15 @@ hook` callables on :data:`sys.path_hooks`, then the following protocol is used to ask the finder for a module spec, which is then used when loading the module. +The current working directory -- denoted by an empty string -- is handled +slightly differently from other entries on :data:`sys.path`. First, if the +current working directory is found to not exist, no value is stored in +:data:`sys.path_importer_cache`. Second, the value for the current working +directory is looked up fresh for each module lookup. Third, the path used for +:data:`sys.path_importer_cache` and returned by +:meth:`importlib.machinery.PathFinder.find_spec` will be the actual current +working directory and not the empty string. + Path entry finder protocol -------------------------- |