aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2023-12-25 02:18:24 -0500
committerEli Schwartz <eschwartz93@gmail.com>2024-02-12 18:52:43 -0500
commit546fe0f92b8e3e85f85ee6bdf07f8cc6156f0850 (patch)
tree3678903675427387d2358d91d0a99ad96560ea0f
parente184ef71e5863bcfe2bcd128cf008876afaa8dd3 (diff)
downloadmeson-546fe0f92b8e3e85f85ee6bdf07f8cc6156f0850.zip
meson-546fe0f92b8e3e85f85ee6bdf07f8cc6156f0850.tar.gz
meson-546fe0f92b8e3e85f85ee6bdf07f8cc6156f0850.tar.bz2
correct type signature of Popen_safe to follow stdlib subprocess
The standard library accepts None defaults for some kwargs and we should too.
-rw-r--r--mesonbuild/utils/universal.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 952d6f7..0fb8607 100644
--- a/mesonbuild/utils/universal.py
+++ b/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)