summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-08 08:24:10 -0700
committerGitHub <noreply@github.com>2019-06-08 08:24:10 -0700
commit10b4fd98142edef6ab7b034e10ae5c9551043999 (patch)
treef0c4531309cf697797a682343bc5bd08ad16b38a /Lib
parent6692d35317a45905a043dccae3940ea5d5d84352 (diff)
downloadcpython-git-10b4fd98142edef6ab7b034e10ae5c9551043999.tar.gz
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. (cherry picked from commit 8cc605acdda5aff250ab4c9b524a7560f90ca9f3) Co-authored-by: RĂ©mi Lapeyre <remi.lapeyre@henki.fr>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/subprocess.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 3c1abb74c2..53a5e72099 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -458,12 +458,12 @@ def run(*popenargs,
The other arguments are the same as for the Popen constructor.
"""
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.')
kwargs['stdin'] = PIPE
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 '
'with capture_output.')
kwargs['stdout'] = PIPE