This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: can we accept os.PathLike objects within the subprocess args= list?
Type: enhancement Stage: needs patch
Components: Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, gregory.p.smith
Priority: normal Keywords:

Created on 2019-11-03 08:13 by gregory.p.smith, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg355890 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2019-11-03 08:13
We started down this path in https://bugs.python.org/issue31961 but had to revert part of that before 3.7 as the implementation was incomplete making it inconsistent across platforms.  https://github.com/python/cpython/pull/4329.

Specifically accepting PathLike objects within the args list hasn't been ruled out...

There is at least one question about behavior though, is str() called when running on posix systems or bytes() (bytes uses fsencode)?

Or does what gets called depend on the specific sub-type of the path vs the current platform?

Example scenario: if you're processing a PureWindowsPath on a posix system and passing that to a child process, sending that through os.fsencode would presumably be the wrong choice...
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82851
2019-11-14 23:00:20eric.smithsetnosy: + eric.smith
2019-11-03 08:13:12gregory.p.smithcreate