bpo-35246: fix support for path-like args in asyncio subprocess (GH-1… · python/cpython@744c08a (original) (raw)
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1605,11 +1605,6 @@ async def subprocess_exec(self, protocol_factory, program, *args, | ||
1605 | 1605 | raise ValueError("errors must be None") |
1606 | 1606 | |
1607 | 1607 | popen_args = (program,) + args |
1608 | -for arg in popen_args: | |
1609 | -if not isinstance(arg, (str, bytes)): | |
1610 | -raise TypeError( | |
1611 | -f"program arguments must be a bytes or text string, " | |
1612 | -f"not {type(arg).__name__}") | |
1613 | 1608 | protocol = protocol_factory() |
1614 | 1609 | debug_log = None |
1615 | 1610 | if self._debug: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -622,6 +622,17 @@ async def execute(): | ||
622 | 622 | self.loop.run_until_complete(execute()) |
623 | 623 | |
624 | 624 | |
625 | +def test_create_subprocess_exec_with_path(self): | |
626 | +async def execute(): | |
627 | +p = await subprocess.create_subprocess_exec( | |
628 | +support.FakePath(sys.executable), '-c', 'pass') | |
629 | +await p.wait() | |
630 | +p = await subprocess.create_subprocess_exec( | |
631 | +sys.executable, '-c', 'pass', support.FakePath('.')) | |
632 | +await p.wait() | |
633 | + | |
634 | +self.assertIsNone(self.loop.run_until_complete(execute())) | |
635 | + | |
625 | 636 | if sys.platform != 'win32': |
626 | 637 | # Unix |
627 | 638 | class SubprocessWatcherMixin(SubprocessMixin): |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 | +Make :func:`asyncio.create_subprocess_exec` accept path-like arguments. |