Ned Deily added the comment: The result of PATH= is also platform dependent. Testing on OS X which has a BSD heritage rather a Linux one:
$ PATH= /usr/bin/which python ./python # without patch $ PATH= ./python -c 'import shutil; print(shutil.which("python"))' python $ ./python -c 'import shutil; print(shutil.which("python", path=""))' /usr/bin/python # with the patch: $ PATH= ./python -c 'import shutil; print(shutil.which("python"))' None $ ./python -c 'import shutil; print(shutil.which("python", path=""))' None So, for OS X, shutil.which doesn't match /usr/bin/which behavior for the PATH= case either with or without the patch. FreeBSD (8.2) /usr/bin/which is the same. The other cases are the same as Linux. I suppose the patched behavior is preferable, though. In any case, the shutil.which docs also need to be updated. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17012> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com