give the C implementation of TextIOWrapper the errors property #6217
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index c1cdf43..bbf65bc 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1286,6 +1286,13 @@
"""
return None
+ @property
+ def errors(self):
+ """Error setting of the decoder or encoder.
+
+ Subclasses should override."""
+ return None
+
io.TextIOBase.register(TextIOBase)
@@ -1933,6 +1940,10 @@
return object.__repr__(self)
@property
+ def errors(self):
+ return None
+
+ @property
def encoding(self):
return None
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 1337b7c..4405d99 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2024,6 +2024,12 @@
with self.open(filename, 'rb') as f:
self.assertEquals(f.read(), 'bbbzzz'.encode(charset))
+ def test_errors_property(self):
+ with self.open(support.TESTFN, "w") as f:
+ self.assertEqual(f.errors, "strict")
+ with self.open(support.TESTFN, "w", errors="replace") as f:
+ self.assertEqual(f.errors, "replace")
+
class CTextIOWrapperTest(TextIOWrapperTest):
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index d94d9dd..0d044e9 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -459,9 +459,9 @@
# These are just dummy values but we nevertheless check them for fear
# of unexpected breakage.
- self.assertTrue(memio.encoding is None)
- self.assertEqual(memio.errors, "strict")
- self.assertEqual(memio.line_buffering, False)
+ self.assertIsNone(memio.encoding)
+ self.assertIsNone(memio.errors)
+ self.assertFalse(memio.line_buffering)
def test_newline_none(self):
# newline=None