Revert "bpo-43510: PEP 597: Accept encoding="locale" in binary mode (GH-25103)" (#25108)

This reverts commit ff3c9739bd.
This commit is contained in:
Inada Naoki 2021-03-31 18:49:41 +09:00 committed by GitHub
parent ff3c9739bd
commit cfa176685a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 14 deletions

View file

@ -531,17 +531,6 @@ class IOTest(unittest.TestCase):
self.assertRaises(OSError, obj.truncate)
self.assertRaises(OSError, obj.truncate, 0)
def test_open_binmode_encoding(self):
"""open() raises ValueError when encoding is specified in bin mode"""
self.assertRaises(ValueError, self.open, os_helper.TESTFN,
"wb", encoding="utf-8")
# encoding=None and encoding="locale" is allowed.
with self.open(os_helper.TESTFN, "wb", encoding=None):
pass
with self.open(os_helper.TESTFN, "wb", encoding="locale"):
pass
def test_open_handles_NUL_chars(self):
fn_with_NUL = 'foo\0bar'
self.assertRaises(ValueError, self.open, fn_with_NUL, 'w')