Skip to content

Commit bf837fb

Browse files
committed
[3.12] Docs: Reference os.environ as :data: (GH-124494)
1 parent 2b54a4e commit bf837fb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Doc/library/shutil.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,10 @@ Directory and files operations
439439
*mode* is a permission mask passed to :func:`os.access`, by default
440440
determining if the file exists and is executable.
441441

442-
When no *path* is specified, the results of :func:`os.environ` are used,
443-
returning either the "PATH" value or a fallback of :data:`os.defpath`.
442+
*path* is a "``PATH`` string" specifying the directories to look in,
443+
delimited by :data:`os.pathsep`. When no *path* is specified, the
444+
:envvar:`PATH` environment variable is read from :data:`os.environ`,
445+
falling back to :data:`os.defpath` if it is not set.
444446

445447
On Windows, the current directory is prepended to the *path* if *mode* does
446448
not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the
@@ -449,9 +451,9 @@ Directory and files operations
449451
consulting the current working directory for executables: set the environment
450452
variable ``NoDefaultCurrentDirectoryInExePath``.
451453

452-
Also on Windows, the ``PATHEXT`` variable is used to resolve commands
453-
that may not already include an extension. For example, if you call
454-
``shutil.which("python")``, :func:`which` will search ``PATHEXT``
454+
Also on Windows, the :envvar:`PATHEXT` environment variable is used to
455+
resolve commands that may not already include an extension. For example,
456+
if you call ``shutil.which("python")``, :func:`which` will search ``PATHEXT``
455457
to know that it should look for ``python.exe`` within the *path*
456458
directories. For example, on Windows::
457459

0 commit comments

Comments
 (0)