summaryrefslogtreecommitdiffstats
path: root/Lib/io.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-06-12 01:13:54 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-06-12 01:13:54 (GMT)
commit3ade6f9007d72adaad0979721b2f39303c71618f (patch)
tree5ca7b2540fe198e14c0129c6231f163202fe524d /Lib/io.py
parent3c415a26e3002ef1219c8b5a8798d35180653c35 (diff)
downloadcpython-3ade6f9007d72adaad0979721b2f39303c71618f.zip
cpython-3ade6f9007d72adaad0979721b2f39303c71618f.tar.gz
cpython-3ade6f9007d72adaad0979721b2f39303c71618f.tar.bz2
Fixed test_tempfile.
Added the encoding, errors, line_buffering attribute to io.StringIO make more compatible with TextIOWrapper's API.
Diffstat (limited to 'Lib/io.py')
-rw-r--r--Lib/io.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/io.py b/Lib/io.py
index f543e20..ef0ce1a 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1839,6 +1839,22 @@ try:
raise UnsupportedOperation("%s.buffer attribute is unsupported" %
self.__class__.__name__)
+ # XXX Cruft to support the TextIOWrapper API. This would only
+ # be meaningful if StringIO supported the buffer attribute.
+ # Hopefully, a better solution, than adding these pseudo-attributes,
+ # will be found.
+ @property
+ def encoding(self):
+ return "utf-8"
+
+ @property
+ def errors(self):
+ return "strict"
+
+ @property
+ def line_buffering(self):
+ return False
+
def _decode_newlines(self, input, final=False):
# decode input (with the eventual \r from a previous pass)
if self._pending: