diff options
author | Raymond Hettinger <python@rcn.com> | 2014-07-25 17:26:36 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2014-07-25 17:26:36 (GMT) |
commit | 1b5f58d1670852871a9865a7b67e14626561f8d1 (patch) | |
tree | 15cbf2f6911879ad6db24ce1e352b40d24ec1956 /Lib/xml/sax | |
parent | 2ce9ddd041c8c93ba55d30757960f1f876f9dae8 (diff) | |
download | cpython-1b5f58d1670852871a9865a7b67e14626561f8d1.zip cpython-1b5f58d1670852871a9865a7b67e14626561f8d1.tar.gz cpython-1b5f58d1670852871a9865a7b67e14626561f8d1.tar.bz2 |
Issue #21990: Cleanup unnecessary inner class definition in saxutils.
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r-- | Lib/xml/sax/saxutils.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py index 1abcd9a..1b89e31 100644 --- a/Lib/xml/sax/saxutils.py +++ b/Lib/xml/sax/saxutils.py @@ -98,14 +98,17 @@ def _gettextwriter(out, encoding): except AttributeError: pass # wrap a binary writer with TextIOWrapper - class UnbufferedTextIOWrapper(io.TextIOWrapper): - def write(self, s): - super(UnbufferedTextIOWrapper, self).write(s) - self.flush() - return UnbufferedTextIOWrapper(buffer, encoding=encoding, + return _UnbufferedTextIOWrapper(buffer, encoding=encoding, errors='xmlcharrefreplace', newline='\n') + +class _UnbufferedTextIOWrapper(io.TextIOWrapper): + def write(self, s): + super(_UnbufferedTextIOWrapper, self).write(s) + self.flush() + + class XMLGenerator(handler.ContentHandler): def __init__(self, out=None, encoding="iso-8859-1"): |