Skip to content

bpo-34886: Fix subprocess.run handling of exclusive arguments #11727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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.