diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py index 90ef5cd363b..8c76bc701e4 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)