summaryrefslogtreecommitdiffstats
path: root/Lib/shutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index c2f0278..6879d8b 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -1090,7 +1090,11 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
return cmd
return None
- path = (path or os.environ.get("PATH", os.defpath)).split(os.pathsep)
+ if path is None:
+ path = os.environ.get("PATH", os.defpath)
+ if not path:
+ return None
+ path = path.split(os.pathsep)
if sys.platform == "win32":
# The current directory takes precedence on Windows.