From 5b668681561723db1c07f314d1d20b7ea9f6cc20 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Thu, 4 Jun 2020 16:11:53 +0100 Subject: [PATCH] Allow Path in create_subprocess_* (#4159) --- stdlib/3/asyncio/subprocess.pyi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/3/asyncio/subprocess.pyi b/stdlib/3/asyncio/subprocess.pyi index d968a156c..4423040cc 100644 --- a/stdlib/3/asyncio/subprocess.pyi +++ b/stdlib/3/asyncio/subprocess.pyi @@ -1,9 +1,16 @@ +import sys from asyncio import events from asyncio import protocols from asyncio import streams from asyncio import transports from typing import Any, Optional, Text, Tuple, Union, IO +if sys.version_info >= (3, 8): + from os import PathLike + _ExecArg = Union[str, bytes, PathLike[str], PathLike[bytes]] +else: + _ExecArg = Union[str, bytes] # Union used instead of AnyStr due to mypy issue #1236 + PIPE: int STDOUT: int DEVNULL: int @@ -49,8 +56,8 @@ async def create_subprocess_shell( ) -> Process: ... async def create_subprocess_exec( - program: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236 - *args: Any, + program: _ExecArg, + *args: _ExecArg, stdin: Union[int, IO[Any], None] = ..., stdout: Union[int, IO[Any], None] = ..., stderr: Union[int, IO[Any], None] = ...,