mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Fixed test_tempfile.
Added the encoding, errors, line_buffering attribute to io.StringIO make more compatible with TextIOWrapper's API.
This commit is contained in:
parent
3c415a26e3
commit
3ade6f9007
2 changed files with 17 additions and 1 deletions
16
Lib/io.py
16
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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue