Skip to content

Commit

Permalink
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-2…
Browse files Browse the repository at this point in the history
  • Loading branch information
methane authored Apr 1, 2021
1 parent ad493ed commit 55f31be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Lib/test/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def testReadinto_text(self):
# 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)

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_file_eintr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 55f31be

Please sign in to comment.