summaryrefslogtreecommitdiff
path: root/Doc/reference
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-11-21 12:19:28 -0500
committerBrett Cannon <brett@python.org>2014-11-21 12:19:28 -0500
commitb00734557c605a4f042e4d7b7e91f2e9c557a933 (patch)
tree8f6f1e89a5e81fa752b5a491e02efc5270367cda /Doc/reference
parent75e2b8703e1a54eff648c603b9a6747383d90a55 (diff)
downloadcpython-b00734557c605a4f042e4d7b7e91f2e9c557a933.tar.gz
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.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index dbb2e0a671..99b77bed78 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
--------------------------