STINNER Victor <vstin...@redhat.com> added the comment:

I'm working on PR but I found an issue.

shutil.which() behaves differently than subprocess, 
distutils.spawn.find_executable() and os.execv() when PATH is set but set to an 
empty string:

* os.get_exec_path() returns ['']
* shutil.which() returns None: DON'T RUN
* subprocess RUNS the program
* distutils.spawn.find_executable('program') returns 'program': RUN the program
* os.execv() RUNS the program

Using PATH=":", they all run the program and os.get_exec_path() returns ['', 
''].

Who is right? Which behavior do we want for Python?

Note: When PATH is set to an empty string, shutil.which() and 
distutils.spawn.find_executable() use the empty string, they don't use 
os.defpath.

----------
Added file: https://bugs.python.org/file48065/empty_path.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35755>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to