]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918). (GH-91946)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 26 Apr 2022 07:50:22 +0000 (10:50 +0300)
committerGitHub <noreply@github.com>
Tue, 26 Apr 2022 07:50:22 +0000 (10:50 +0300)
(cherry picked from commit 36306cf7862097318a3fef74224075cc4cf37229)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_netrc.py

index 90ef5cd363b3fb406d5ccc1378596415a80a6032..8c76bc701e4944627c6a08b7df4eee8f13899dbb 100644 (file)
@@ -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)