[pexpect] Accept dict for env parameter, not just os.environ (#15270)

This commit is contained in:
Emmanuel Ferdman
2026-01-26 12:08:27 +02:00
committed by GitHub
parent 0664473614
commit f424458cbb
5 changed files with 12 additions and 14 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
import subprocess
from _typeshed import StrOrBytesPath
from collections.abc import Callable
from os import _Environ
from typing import AnyStr
from .spawnbase import SpawnBase, _Logfile
@@ -17,7 +16,7 @@ class PopenSpawn(SpawnBase[AnyStr]):
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: StrOrBytesPath | None = None,
env: _Environ[str] | None = None,
env: subprocess._ENV | None = None,
encoding: str | None = None,
codec_errors: str = "strict",
preexec_fn: Callable[[], None] | None = None,
+4 -5
View File
@@ -1,6 +1,5 @@
from _typeshed import FileDescriptorOrPath
from collections.abc import Callable
from os import _Environ
from collections.abc import Callable, Mapping
from typing import AnyStr
from .spawnbase import SpawnBase, _Logfile
@@ -14,7 +13,7 @@ class spawn(SpawnBase[AnyStr]):
STDERR_FILENO: int
str_last_chars: int
cwd: FileDescriptorOrPath | None
env: _Environ[str]
env: Mapping[str, str] | None
echo: bool
ignore_sighup: bool
command: str
@@ -30,7 +29,7 @@ class spawn(SpawnBase[AnyStr]):
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
env: Mapping[str, str] | None = None,
ignore_sighup: bool = False,
echo: bool = True,
preexec_fn: Callable[[], None] | None = None,
@@ -84,7 +83,7 @@ def spawnu(
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
env: Mapping[str, str] | None = None,
ignore_sighup: bool = False,
echo: bool = True,
preexec_fn: Callable[[], None] | None = None,
+2 -2
View File
@@ -1,5 +1,5 @@
from _typeshed import FileDescriptorOrPath
from os import _Environ
from collections.abc import Mapping
from typing import AnyStr, Literal
from .exceptions import ExceptionPexpect
@@ -28,7 +28,7 @@ class pxssh(spawn[AnyStr]):
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
env: Mapping[str, str] | None = None,
ignore_sighup: bool = True,
echo: bool = True,
options: dict[str, str] = {},
+3 -3
View File
@@ -1,5 +1,5 @@
from _typeshed import FileDescriptorOrPath
from os import _Environ
from collections.abc import Mapping
from typing import AnyStr
from .spawnbase import _InputRePattern, _Logfile
@@ -12,7 +12,7 @@ def run(
extra_args: None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
env: Mapping[str, str] | None = None,
**kwargs,
) -> AnyStr | tuple[AnyStr, int]: ...
def runu(
@@ -23,6 +23,6 @@ def runu(
extra_args: None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
env: Mapping[str, str] | None = None,
**kwargs,
) -> AnyStr | tuple[AnyStr, int]: ...
+2 -2
View File
@@ -1,10 +1,10 @@
from os import _Environ
from collections.abc import Mapping
InterruptedError: type
string_types: tuple[type, ...]
def is_executable_file(path): ...
def which(filename, env: _Environ[str] | None = None): ...
def which(filename, env: Mapping[str, str] | None = None): ...
def split_command_line(command_line): ...
def select_ignore_interrupts(iwtd, owtd, ewtd, timeout: float | None = None): ...
def poll_ignore_interrupts(fds, timeout: float | None = None): ...