From: Serhiy Storchaka Date: Mon, 20 Oct 2025 17:05:42 +0000 (+0300) Subject: [3.14] gh-63161: Fix test_source_encoding when stderr is StringIO (GH-140361) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=abb3b3142b2ac25e034a1d52fcb08f8b71b1e023;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-63161: Fix test_source_encoding when stderr is StringIO (GH-140361) --- 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)