From: Serhiy Storchaka Date: Tue, 26 Apr 2022 07:50:22 +0000 (+0300) Subject: [3.10] gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918). (GH-91946) X-Git-Tag: v3.10.5~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbe666d39880352360cb07787d47237448196bf4;p=thirdparty%2FPython%2Fcpython.git [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 --- 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)