summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r--Lib/xml/sax/saxutils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index dad74f5..3d81a8e 100644
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -98,9 +98,13 @@ def _gettextwriter(out, encoding):
except AttributeError:
pass
# wrap a binary writer with TextIOWrapper
- return io.TextIOWrapper(buffer, encoding=encoding,
- errors='xmlcharrefreplace',
- newline='\n')
+ class UnbufferedTextIOWrapper(io.TextIOWrapper):
+ def write(self, s):
+ super(UnbufferedTextIOWrapper, self).write(s)
+ self.flush()
+ return UnbufferedTextIOWrapper(buffer, encoding=encoding,
+ errors='xmlcharrefreplace',
+ newline='\n')
class XMLGenerator(handler.ContentHandler):