[Python-3000-checkins] r64159 - in python/branches/py3k/Lib: io.py tempfile.py
alexandre.vassalotti
python-3000-checkins at python.org
Thu Jun 12 03:13:54 CEST 2008
Author: alexandre.vassalotti
Date: Thu Jun 12 03:13:54 2008
New Revision: 64159
Log:
Fixed test_tempfile.
Added the encoding, errors, line_buffering attribute to io.StringIO
make more compatible with TextIOWrapper's API.
Modified:
python/branches/py3k/Lib/io.py
python/branches/py3k/Lib/tempfile.py
Modified: python/branches/py3k/Lib/io.py
==============================================================================
--- python/branches/py3k/Lib/io.py (original)
+++ python/branches/py3k/Lib/io.py Thu Jun 12 03:13:54 2008
@@ -1839,6 +1839,22 @@
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:
Modified: python/branches/py3k/Lib/tempfile.py
==============================================================================
--- python/branches/py3k/Lib/tempfile.py (original)
+++ python/branches/py3k/Lib/tempfile.py Thu Jun 12 03:13:54 2008
@@ -502,7 +502,7 @@
# Setting newline="\n" avoids newline translation;
# this is important because otherwise on Windows we'd
# hget double newline translation upon rollover().
- self._file = _io.StringIO(encoding=encoding, newline="\n")
+ self._file = _io.StringIO(newline="\n")
self._max_size = max_size
self._rolled = False
self._TemporaryFileArgs = {'mode': mode, 'buffering': buffering,
More information about the Python-3000-checkins
mailing list