]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)
authorInada Naoki <songofacandy@gmail.com>
Thu, 1 Apr 2021 02:23:03 +0000 (11:23 +0900)
committerGitHub <noreply@github.com>
Thu, 1 Apr 2021 02:23:03 +0000 (11:23 +0900)
Lib/test/test_file.py
Lib/test/test_file_eintr.py

index 149767591d9eb55538740746f4d800fcdc4000c7..fbfba64759a1e40d82023c498a23140ef7c1c982 100644 (file)
@@ -52,7 +52,7 @@ class AutoFileTests:
         # verify readinto refuses text files
         a = array('b', b'x'*10)
         self.f.close()
-        self.f = self.open(TESTFN, 'r')
+        self.f = self.open(TESTFN, encoding="utf-8")
         if hasattr(self.f, "readinto"):
             self.assertRaises(TypeError, self.f.readinto, a)
 
index f1efd266ffb62b128080eaa9f1e92ef4b94dfa8a..01408d838a83ccea338447434548be2c753a2adb 100644 (file)
@@ -213,7 +213,7 @@ class TestTextIOSignalInterrupt(TestFileIOSignalInterrupt):
     def _generate_infile_setup_code(self):
         """Returns the infile = ... line of code to make a TextIOWrapper."""
         return ('import %s as io ;'
-                'infile = io.open(sys.stdin.fileno(), "rt", newline=None) ;'
+                'infile = io.open(sys.stdin.fileno(), encoding="utf-8", newline=None) ;'
                 'assert isinstance(infile, io.TextIOWrapper)' %
                 self.modname)