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

serhiy-storchaka webhook-mailer at python.org
Tue Apr 26 00:58:45 EDT 2022


https://github.com/python/cpython/commit/36306cf7862097318a3fef74224075cc4cf37229
commit: 36306cf7862097318a3fef74224075cc4cf37229
branch: main
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2022-04-26T07:58:41+03:00
summary:

gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918)

files:
M Lib/test/test_netrc.py

diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py
index a6b4bc47a32c1..3cca1e8ff1ac1 100644
--- a/Lib/test/test_netrc.py
+++ b/Lib/test/test_netrc.py
@@ -10,7 +10,7 @@ def make_nrc(self, test_data):
         mode = 'w'
         if sys.platform != 'cygwin':
             mode += 't'
-        with open(temp_filename, mode) as fp:
+        with open(temp_filename, mode, encoding="utf-8") as fp:
             fp.write(test_data)
         try:
             nrc = netrc.netrc(temp_filename)



More information about the Python-checkins mailing list