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/test | |
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/test')
-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 f685492..424a4a9 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: |