diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2022-10-05 00:47:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 00:47:49 (GMT) |
commit | db64fb9bbe92b212db7dd173f787ea3607ae971a (patch) | |
tree | 792388cef007d2b5d95435f9d1afc3f2592009fc /Lib/subprocess.py | |
parent | 0ceafa7fa408b64377ea31dd5386152da19ef38a (diff) | |
download | cpython-db64fb9bbe92b212db7dd173f787ea3607ae971a.zip cpython-db64fb9bbe92b212db7dd173f787ea3607ae971a.tar.gz cpython-db64fb9bbe92b212db7dd173f787ea3607ae971a.tar.bz2 |
gh-97825: fix AttributeError when calling subprocess.check_output(input=None) with encoding or errors args (#97826)
* fix AttributeError, add unit test
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 7ae8df1..760b93b 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -456,7 +456,8 @@ def check_output(*popenargs, timeout=None, **kwargs): if 'input' in kwargs and kwargs['input'] is None: # Explicitly passing input=None was previously equivalent to passing an # empty string. That is maintained here for backwards compatibility. - if kwargs.get('universal_newlines') or kwargs.get('text'): + if kwargs.get('universal_newlines') or kwargs.get('text') or kwargs.get('encoding') \ + or kwargs.get('errors'): empty = '' else: empty = b'' |