gh-161788: Handle path-like commands in shutil.which() (#161789)

Resolve command objects through the path protocol before selecting text or
bytes handling. This preserves the documented bytes return type for
path-like objects backed by bytes.

Ref #161788
3 files changed