Roundup Robot added the comment:
New changeset eb8c575fa781 by Barry Warsaw in branch '3.3':
- Issue #17012: shutil.which() no longer fallbacks to the PATH environment
http://hg.python.org/cpython/rev/eb8c575fa781
New changeset 8f5b37f8f964 by Barry Warsaw in branch 'default':
- Issue #17012:
Barry A. Warsaw added the comment:
I couldn't wait. :)
--
assignee: serhiy.storchaka - barry
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
Changes by Barry A. Warsaw ba...@python.org:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
Changes by Barry A. Warsaw ba...@python.org:
--
nosy: +barry
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
Python-bugs-list mailing
Barry A. Warsaw added the comment:
From a documentation standpoint, path='' is not the same as When no path is
specified, so indeed it should return None when path=''. Serhiy's patch
looks good to me.
--
___
Python tracker rep...@bugs.python.org
Changes by Barry A. Warsaw ba...@python.org:
--
assignee: - barry
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
Python-bugs-list
Changes by Barry A. Warsaw ba...@python.org:
--
assignee: barry - serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
Barry A. Warsaw added the comment:
Serhiy, I'd say go ahead and commit it. +1 from me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
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
Serhiy Storchaka added the comment:
Ping.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
Python-bugs-list mailing list
Serhiy Storchaka added the comment:
Thank you, Ned, for information.
Here is a patch which remove the first difference (processing an empty path).
The second difference is not semantically significant and I'm not sure whether
we need to get rid of it.
--
keywords: +patch
Added file:
Changes by Serhiy Storchaka storch...@gmail.com:
--
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
New submission from Serhiy Storchaka:
$ PATH= /usr/bin/which python
$ PATH=: /usr/bin/which python
./python
$ PATH=/usr: /usr/bin/which python
./python
shutil.which('python', path='')
'/usr/bin/python'
shutil.which('python', path=':')
'python'
shutil.which('python', path='/usr:')
'python'
Antoine Pitrou added the comment:
I'm not sure reproducing the quirks of /usr/bin/which is a good idea.
shutil.which() is meant to be useful and easy to understand, not to be 100%
bash-compatible.
And, anyway, what would be the point of passing an empty path, if the return
value is guaranteed
Serhiy Storchaka added the comment:
/usr/bin/which is not a Bash. ;)
The path can be unexpectedly empty. If we got None then we can detect the
error, but if we got something out of the path then we can miss our fault.
--
___
Python tracker
R. David Murray added the comment:
What I think it is suppose to do (the user expects it to do) is find the
program that would be run if the command were typed at the command prompt.
rdmurray@hey:~which python
/usr/bin/python
rdmurray@hey:~export PATH=
rdmurray@hey:~which python
python not
Serhiy Storchaka added the comment:
No, I noted that result of PATH=: or PATH=$PATH: can be platform dependent (I'm
not sure).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
R. David Murray added the comment:
I was speaking in general of 'which program would be executed if the command is
typed at the prompt' as being system dependent, which it demonstrably is since
the behavior on unix and windows differs with regards to the current directory.
--
R. David Murray added the comment:
And no, what I wrote wasn't clear :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17012
___
___
Ned Deily added the comment:
FWIW, the POSIX standard gives some guidance on how PATH is to be interpreted
for conforming systems, including:
A zero-length prefix is a legacy feature that indicates the current working
directory. It appears as two adjacent colon characters ( :: ), as an
20 matches
Mail list logo