Issue #16957: shutil.which() no longer searches a bare file name in the
current directory on Unix and no longer searches a relative file path with
a directory part in PATH directories.  Patch by Thomas Kluyver.
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 86c32fa..e4b640c 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -1077,10 +1077,13 @@
         return (os.path.exists(fn) and os.access(fn, mode)
                 and not os.path.isdir(fn))
 
-    # Short circuit. If we're given a full path which matches the mode
-    # and it exists, we're done here.
-    if _access_check(cmd, mode):
-        return cmd
+    # If we're given a path with a directory part, look it up directly rather
+    # than referring to PATH directories. This includes checking relative to the
+    # current directory, e.g. ./script
+    if os.path.dirname(cmd):
+        if _access_check(cmd, mode):
+            return cmd
+        return None
 
     path = (path or os.environ.get("PATH", os.defpath)).split(os.pathsep)