From bd23f91418c694771b9339a17a60a14df80ae0ea Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 29 Jan 2022 19:26:25 +0000 Subject: [PATCH 1/2] bpo-44031: fix test_tabnanny failure in non-ascii CWD --- Lib/test/test_tabnanny.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tabnanny.py b/Lib/test/test_tabnanny.py index 4dfbd2985d5b5a..1710abd8152d92 100644 --- a/Lib/test/test_tabnanny.py +++ b/Lib/test/test_tabnanny.py @@ -293,8 +293,8 @@ def validate_cmd(self, *args, stdout="", stderr="", partial=False): _, out, err = script_helper.assert_python_ok('-m', 'tabnanny', *args) # Note: The `splitlines()` will solve the problem of CRLF(\r) added # by OS Windows. - out = out.decode('ascii') - err = err.decode('ascii') + out = out.decode('utf-8') + err = err.decode('utf-8') if partial: for std, output in ((stdout, out), (stderr, err)): _output = output.splitlines() From 74e878454e3e3a8d2464f35d0f8f263ecf27b093 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sun, 30 Jan 2022 15:27:55 +0000 Subject: [PATCH 2/2] use fsdecode --- Lib/test/test_tabnanny.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tabnanny.py b/Lib/test/test_tabnanny.py index 1710abd8152d92..59fdfc5573d373 100644 --- a/Lib/test/test_tabnanny.py +++ b/Lib/test/test_tabnanny.py @@ -293,8 +293,8 @@ def validate_cmd(self, *args, stdout="", stderr="", partial=False): _, out, err = script_helper.assert_python_ok('-m', 'tabnanny', *args) # Note: The `splitlines()` will solve the problem of CRLF(\r) added # by OS Windows. - out = out.decode('utf-8') - err = err.decode('utf-8') + out = os.fsdecode(out) + err = os.fsdecode(err) if partial: for std, output in ((stdout, out), (stderr, err)): _output = output.splitlines()