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

(cherry picked from commit 36306cf786)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Serhiy Storchaka 2022-04-26 10:50:22 +03:00 committed by GitHub
parent 3e219d3123
commit dbe666d398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)