[Python-checkins] [3.10] gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918). (GH-91946)

serhiy-storchaka webhook-mailer at python.org
Tue Apr 26 03:50:55 EDT 2022


https://github.com/python/cpython/commit/dbe666d39880352360cb07787d47237448196bf4
commit: dbe666d39880352360cb07787d47237448196bf4
branch: 3.10
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2022-04-26T10:50:22+03:00
summary:

[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 <storchaka at gmail.com>

files:
M Lib/test/test_netrc.py

diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py
index 90ef5cd363b3f..8c76bc701e494 100644
--- a/Lib/test/test_netrc.py
+++ b/Lib/test/test_netrc.py
@@ -11,7 +11,7 @@ def make_nrc(self, test_data):
         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)



More information about the Python-checkins mailing list