[issue41465] io.TextIOWrapper.errors not writable
Walter Dörwald
report at bugs.python.org
Mon Aug 3 14:29:12 EDT 2020
New submission from Walter Dörwald <walter at livinglogic.de>:
PEP 293 states the following:
"""
For stream readers/writers the errors attribute must be changeable to be able to switch between different error handling methods during the lifetime of the stream reader/writer. This is currently the case for codecs.StreamReader and codecs.StreamWriter and all their subclasses. All core codecs and probably most of the third party codecs (e.g. JapaneseCodecs) derive their stream readers/writers from these classes so this already works, but the attribute errors should be documented as a requirement.
"""
However for io.TextIOWrapper, the errors attribute can not be changed:
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> s = io.TextIOWrapper(io.BytesIO())
>>> s.errors = 'replace'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: attribute 'errors' of '_io.TextIOWrapper' objects is not writable
So the errors attribute of io.TextIOWrapper should be made writable.
----------
components: IO
messages: 374751
nosy: doerwalter
priority: normal
severity: normal
status: open
title: io.TextIOWrapper.errors not writable
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41465>
_______________________________________
More information about the Python-bugs-list
mailing list