summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-07-25 17:26:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-07-25 17:26:36 (GMT)
commit1b5f58d1670852871a9865a7b67e14626561f8d1 (patch)
tree15cbf2f6911879ad6db24ce1e352b40d24ec1956 /Lib/xml/sax
parent2ce9ddd041c8c93ba55d30757960f1f876f9dae8 (diff)
downloadcpython-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.py13
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"):