diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-04-17 14:26:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 14:26:36 (GMT) |
commit | 228a3c99bdb2d02771bead66a0beabafad3a90d3 (patch) | |
tree | 40ff4e1063f1205ad1f32f9005ba3675531c19a4 /Misc | |
parent | 71ce03df9c643faa94fbdf73bbb4e99a9a62cbdc (diff) | |
download | cpython-228a3c99bdb2d02771bead66a0beabafad3a90d3.zip cpython-228a3c99bdb2d02771bead66a0beabafad3a90d3.tar.gz cpython-228a3c99bdb2d02771bead66a0beabafad3a90d3.tar.bz2 |
bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12858)
shutil.which() and distutils.spawn.find_executable() now use
os.confstr("CS_PATH") if available instead of os.defpath, if the PATH
environment variable is not set.
Don't use os.confstr("CS_PATH") nor os.defpath if the PATH
environment variable is set to an empty string to mimick Unix 'which'
command behavior.
Changes:
* find_executable() now starts by checking for the executable in the
current working directly case. Add an explicit
"if not path: return None".
* Add tests for PATH='' (empty string), PATH=':' and for PATHEXT.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-04-16-17-50-39.bpo-35755.Fg4EXb.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-04-16-17-50-39.bpo-35755.Fg4EXb.rst b/Misc/NEWS.d/next/Library/2019-04-16-17-50-39.bpo-35755.Fg4EXb.rst new file mode 100644 index 0000000..8e92ffd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-04-16-17-50-39.bpo-35755.Fg4EXb.rst @@ -0,0 +1,6 @@ +:func:`shutil.which` and :func:`distutils.spawn.find_executable` now use +``os.confstr("CS_PATH")`` if available instead of :data:`os.defpath`, if the +``PATH`` environment variable is not set. Moreover, don't use +``os.confstr("CS_PATH")`` nor :data:`os.defpath` if the ``PATH`` environment +variable is set to an empty string to mimick Unix ``which`` command +behavior. |