Message 182303 - Python tracker (original) (raw)
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.