Skip to content

Commit 9c5479f

Browse files
authored
stdlib: Use PEP646 tuple unpack for precise os.execl(p)e typing (#11133)
1 parent 51ec2f0 commit 9c5479f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stdlib/os/__init__.pyi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ from contextlib import AbstractContextManager
2626
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper as _TextIOWrapper
2727
from subprocess import Popen
2828
from typing import IO, Any, AnyStr, BinaryIO, Generic, NoReturn, Protocol, TypeVar, overload, runtime_checkable
29-
from typing_extensions import Final, Literal, Self, TypeAlias, final
29+
from typing_extensions import Final, Literal, Self, TypeAlias, Unpack, final
3030

3131
from . import path as _path
3232

@@ -847,8 +847,12 @@ def execl(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: StrOrBytesPath) -
847847
def execlp(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: StrOrBytesPath) -> NoReturn: ...
848848

849849
# These are: execle(file, *args, env) but env is pulled from the last element of the args.
850-
def execle(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoReturn: ...
851-
def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoReturn: ...
850+
def execle(
851+
file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]], _ExecEnv]]
852+
) -> NoReturn: ...
853+
def execlpe(
854+
file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]], _ExecEnv]]
855+
) -> NoReturn: ...
852856

853857
# The docs say `args: tuple or list of strings`
854858
# The implementation enforces tuple or list so we can't use Sequence.

0 commit comments

Comments
 (0)