mirror of
https://github.com/python/cpython.git
synced 2025-09-02 06:57:58 +00:00
gh-97825: fix AttributeError when calling subprocess.check_output(input=None) with encoding or errors args (GH-97826)
* fix AttributeError, add unit test
(cherry picked from commit db64fb9bbe
)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
This commit is contained in:
parent
0151375829
commit
9133aabc70
3 changed files with 9 additions and 1 deletions
|
@ -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''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue