diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 24c6d7000..50d05b738 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -819,6 +819,8 @@ else: def WEXITSTATUS(status: int) -> int: ... def WSTOPSIG(status: int) -> int: ... def WTERMSIG(status: int) -> int: ... + if sys.version_info >= (3, 8): + from posix import posix_spawn as posix_spawn, posix_spawnp as posix_spawnp if sys.platform != "win32": from posix import sched_param diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index 249946364..5c5ab4cf4 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -1,6 +1,7 @@ import sys -from os import PathLike, stat_result as stat_result -from typing import Dict, List, NamedTuple, Optional, overload +from _typeshed import StrOrBytesPath +from os import PathLike, _ExecEnv, _ExecVArgs, stat_result as stat_result +from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Sequence, Tuple, overload class uname_result(NamedTuple): sysname: str @@ -166,6 +167,34 @@ def listdir(path: int) -> List[str]: ... @overload def listdir(path: PathLike[str]) -> List[str]: ... +if sys.platform != "win32" and sys.version_info >= (3, 8): + def posix_spawn( + path: StrOrBytesPath, + argv: _ExecVArgs, + env: _ExecEnv, + *, + file_actions: Optional[Sequence[Tuple[Any, ...]]] = ..., + setpgroup: Optional[int] = ..., + resetids: bool = ..., + setsid: bool = ..., + setsigmask: Iterable[int] = ..., + setsigdef: Iterable[int] = ..., + scheduler: Optional[Tuple[Any, sched_param]] = ..., + ) -> int: ... + def posix_spawnp( + path: StrOrBytesPath, + argv: _ExecVArgs, + env: _ExecEnv, + *, + file_actions: Optional[Sequence[Tuple[Any, ...]]] = ..., + setpgroup: Optional[int] = ..., + resetids: bool = ..., + setsid: bool = ..., + setsigmask: Iterable[int] = ..., + setsigdef: Iterable[int] = ..., + scheduler: Optional[Tuple[Any, sched_param]] = ..., + ) -> int: ... + if sys.platform == "win32": environ: Dict[str, str] else: