correct type signature of Popen_safe to follow stdlib subprocess

The standard library accepts None defaults for some kwargs and we should
too.
pull/12839/head
Eli Schwartz 1 year ago
parent e184ef71e5
commit 546fe0f92b
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 12
      mesonbuild/utils/universal.py

@ -1499,9 +1499,9 @@ def partition(pred: T.Callable[[_T], object], iterable: T.Iterable[_T]) -> T.Tup
def Popen_safe(args: T.List[str], write: T.Optional[str] = None,
stdin: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.DEVNULL,
stdout: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stderr: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stdin: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.DEVNULL,
stdout: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stderr: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
**kwargs: T.Any) -> T.Tuple['subprocess.Popen[str]', str, str]:
import locale
encoding = locale.getpreferredencoding()
@ -1531,9 +1531,9 @@ def Popen_safe(args: T.List[str], write: T.Optional[str] = None,
def Popen_safe_legacy(args: T.List[str], write: T.Optional[str] = None,
stdin: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.DEVNULL,
stdout: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stderr: T.Union[T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stdin: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.DEVNULL,
stdout: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
stderr: T.Union[None, T.TextIO, T.BinaryIO, int] = subprocess.PIPE,
**kwargs: T.Any) -> T.Tuple['subprocess.Popen[str]', str, str]:
p = subprocess.Popen(args, universal_newlines=False, close_fds=False,
stdin=stdin, stdout=stdout, stderr=stderr, **kwargs)

Loading…
Cancel
Save