- Issue #16514: Fix regression causing a traceback when sys.path[0] is None
(actually, any non-string or non-bytes type).
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index fdecc76..ef0235d 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -540,7 +540,10 @@
implementation-specific defaults. Entries in :data:`sys.path` can name
directories on the file system, zip files, and potentially other "locations"
(see the :mod:`site` module) that should be searched for modules, such as
-URLs, or database queries.
+URLs, or database queries. Only strings and bytes should be present on
+:data:`sys.path`; all other data types are ignored. The encoding of bytes
+entries is determined by the individual :term:`path entry finders <path entry
+finder>`.
The :term:`path based finder` is a :term:`meta path finder`, so the import
machinery begins the :term:`import path` search by calling the path
@@ -563,14 +566,17 @@
the path based finder to perform the path entry search again [#fnpic]_.
If the path entry is not present in the cache, the path based finder iterates
-over every callable in :data:`sys.path_hooks`. Each of the
-:term:`path entry hooks <path entry hook>` in this list is called with a
-single argument, the path entry to be searched. This callable may either
-return a :term:`path entry finder` that can handle the path entry, or it may
-raise :exc:`ImportError`.
-An :exc:`ImportError` is used by the path based finder to signal that the hook
-cannot find a :term:`path entry finder` for that :term:`path entry`. The
-exception is ignored and :term:`import path` iteration continues.
+over every callable in :data:`sys.path_hooks`. Each of the :term:`path entry
+hooks <path entry hook>` in this list is called with a single argument, the
+path entry to be searched. This callable may either return a :term:`path
+entry finder` that can handle the path entry, or it may raise
+:exc:`ImportError`. An :exc:`ImportError` is used by the path based finder to
+signal that the hook cannot find a :term:`path entry finder` for that
+:term:`path entry`. The exception is ignored and :term:`import path`
+iteration continues. The hook should expect either a string or bytes object;
+the encoding of bytes objects is up to the hook (e.g. it may be a file system
+encoding, UTF-8, or something else), and if the hook cannot decode the
+argument, it should raise :exc:`ImportError`.
If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder`
being returned, then the path based finder's :meth:`find_module()` method