From abb3b3142b2ac25e034a1d52fcb08f8b71b1e023 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 20 Oct 2025 20:05:42 +0300 Subject: [PATCH] [3.14] gh-63161: Fix test_source_encoding when stderr is StringIO (GH-140361) --- 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 a285fc2ceef2..36c8d87182dc 100644 --- a/Lib/test/test_source_encoding.py +++ b/Lib/test/test_source_encoding.py @@ -521,7 +521,7 @@ class FileSourceEncodingTest(AbstractSourceEncodingTest, unittest.TestCase): 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) -- 2.47.3