Add an encoding property to TextIOBase instances.
Add sys.__std{in,out,err}__.
Make test_sys pass.
diff --git a/Lib/io.py b/Lib/io.py
index 072b756..67049e6 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -925,6 +925,11 @@
raise StopIteration
return line
+ @property
+ def encoding(self):
+ """Subclasses should override."""
+ return None
+
# The following are provided for backwards compatibility
def readlines(self, hint=None):
@@ -970,6 +975,10 @@
self._snapshot = None
self._seekable = self._telling = self.buffer.seekable()
+ @property
+ def encoding(self):
+ return self._encoding
+
# A word about _snapshot. This attribute is either None, or a
# tuple (decoder_state, readahead, pending) where decoder_state is
# the second (integer) item of the decoder state, readahead is the