gh-161788: Document path-like support in shutil.which() (#162013)
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 6104ad3..db484be 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst
@@ -532,6 +532,9 @@ or ends with an extension that is in ``PATHEXT``; and filenames that have no extension can now be found. + .. versionchanged:: next + Accepts a :term:`path-like object` for *cmd*. + .. exception:: Error Subclass of :exc:`OSError` collecting exceptions raised during a multi-file
diff --git a/Misc/NEWS.d/next/Library/2026-11-10-23-51-25.gh-issue-161788.J8vQmK.rst b/Misc/NEWS.d/next/Library/2026-11-10-23-51-25.gh-issue-161788.J8vQmK.rst index 21565e3..34d3cff 100644 --- a/Misc/NEWS.d/next/Library/2026-11-10-23-51-25.gh-issue-161788.J8vQmK.rst +++ b/Misc/NEWS.d/next/Library/2026-11-10-23-51-25.gh-issue-161788.J8vQmK.rst
@@ -1,2 +1 @@ -Fix :func:`shutil.which` for path-like command objects whose -:meth:`~os.PathLike.__fspath__` method returns :class:`bytes`. +:func:`shutil.which` now accepts path-like objects for the command.