From 4b78cbd76f56b5a988a02cb7e1a083490a67fddf Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 10 May 2025 10:51:55 +0200 Subject: [PATCH] [3.14] gh-132971: Update shutil.which() docs (GH-133067) (#133803) gh-132971: Update shutil.which() docs (GH-133067) (cherry picked from commit d13d5fdf610a294a6c3dc125e0856fb7fdd41e49) Co-authored-by: Kokona <125976684+985025074@users.noreply.github.com> --- Doc/library/shutil.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 2cbf95bcf535..c78dfe1aafa0 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -454,6 +454,10 @@ Directory and files operations :envvar:`PATH` environment variable is read from :data:`os.environ`, falling back to :data:`os.defpath` if it is not set. + If *cmd* contains a directory component, :func:`!which` only checks the + specified path directly and does not search the directories listed in + *path* or in the system's :envvar:`PATH` environment variable. + On Windows, the current directory is prepended to the *path* if *mode* does not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the Windows API ``NeedCurrentDirectoryForExePathW`` will be consulted to -- 2.47.3