summaryrefslogtreecommitdiffstats
path: root/Lib/io.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-24 17:58:06 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-24 17:58:06 (GMT)
commitfc3436becdc2b0c214afc2d9190e4114fb1a5254 (patch)
tree81eda659b95d8dbe92c12730130120612f5fce8b /Lib/io.py
parent75d6f1a2faf287e0688eb835022352a19a043d49 (diff)
downloadcpython-fc3436becdc2b0c214afc2d9190e4114fb1a5254.zip
cpython-fc3436becdc2b0c214afc2d9190e4114fb1a5254.tar.gz
cpython-fc3436becdc2b0c214afc2d9190e4114fb1a5254.tar.bz2
Add an encoding property to TextIOBase instances.
Add sys.__std{in,out,err}__. Make test_sys pass.
Diffstat (limited to 'Lib/io.py')
-rw-r--r--Lib/io.py9
1 files changed, 9 insertions, 0 deletions
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 @@ class TextIOBase(IOBase):
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 @@ class TextIOWrapper(TextIOBase):
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