diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2022-10-04 20:47:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 17:47:49 -0700 |
commit | db64fb9bbe92b212db7dd173f787ea3607ae971a (patch) | |
tree | 792388cef007d2b5d95435f9d1afc3f2592009fc /Lib/test/test_subprocess.py | |
parent | 0ceafa7fa408b64377ea31dd5386152da19ef38a (diff) | |
download | cpython-git-db64fb9bbe92b212db7dd173f787ea3607ae971a.tar.gz |
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/test/test_subprocess.py')
-rw-r--r-- | Lib/test/test_subprocess.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index f6854922a5..424a4a93b6 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -238,6 +238,12 @@ class ProcessTestCase(BaseTestCase): input=None, universal_newlines=True) self.assertNotIn('XX', output) + def test_check_output_input_none_encoding_errors(self): + output = subprocess.check_output( + [sys.executable, "-c", "print('foo')"], + input=None, encoding='utf-8', errors='ignore') + self.assertIn('foo', output) + def test_check_output_stdout_arg(self): # check_output() refuses to accept 'stdout' argument with self.assertRaises(ValueError) as c: |