From dbe666d39880352360cb07787d47237448196bf4 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 26 Apr 2022 10:50:22 +0300 Subject: [PATCH] [3.10] gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918). (GH-91946) (cherry picked from commit 36306cf7862097318a3fef74224075cc4cf37229) Co-authored-by: Serhiy Storchaka --- Lib/test/test_netrc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py index 90ef5cd363b3..8c76bc701e49 100644 --- a/Lib/test/test_netrc.py +++ b/Lib/test/test_netrc.py @@ -11,7 +11,7 @@ class NetrcTestCase(unittest.TestCase): if sys.platform != 'cygwin': mode += 't' temp_fd, temp_filename = tempfile.mkstemp() - with os.fdopen(temp_fd, mode=mode) as fp: + with os.fdopen(temp_fd, mode=mode, encoding="utf-8") as fp: fp.write(test_data) self.addCleanup(os.unlink, temp_filename) return netrc.netrc(temp_filename) -- 2.47.3