From 81cc44419b7031543ff1afd048c119943f1d1c1d Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 20 Oct 2025 12:33:12 +0300 Subject: [PATCH] Fix test_source_encoding when stderr is StringIO --- Lib/test/test_source_encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py index a285fc2ceef24e..36c8d87182dcf9 100644 --- a/Lib/test/test_source_encoding.py +++ b/Lib/test/test_source_encoding.py @@ -521,7 +521,7 @@ def check_script_error(self, src, expected, lineno=...): line = src.splitlines()[lineno-1].decode(errors='replace') if lineno == 1: line = line.removeprefix('\ufeff') - line = line.encode(sys.stderr.encoding, sys.stderr.errors) + line = line.encode(sys.__stderr__.encoding, sys.__stderr__.errors) self.assertIn(line, err)