Commit 8cc605ac authored by Rémi Lapeyre's avatar Rémi Lapeyre Committed by Gregory P. Smith

bpo-34886: Fix subprocess.run handling of exclusive arguments (GH-11727)

Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
parent a15a7bca
...@@ -459,12 +459,12 @@ def run(*popenargs, ...@@ -459,12 +459,12 @@ def run(*popenargs,
The other arguments are the same as for the Popen constructor. The other arguments are the same as for the Popen constructor.
""" """
if input is not None: if input is not None:
if 'stdin' in kwargs: if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.') raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE kwargs['stdin'] = PIPE
if capture_output: if capture_output:
if ('stdout' in kwargs) or ('stderr' in kwargs): if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used ' raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.') 'with capture_output.')
kwargs['stdout'] = PIPE kwargs['stdout'] = PIPE
......
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr`
args when they were explicitly provided but with `None` values within a
passed in `**kwargs` dict rather than as passed directly by name. Patch
contributed by Rémi Lapeyre.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment