diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-25 11:31:29 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-25 11:31:29 (GMT) |
commit | 93bfe7d860644595eaf2bd5c9bf7db31ee4a4201 (patch) | |
tree | 00832edf0efa6543bdbdd46d86a7643cef28fdba /Lib/xml/sax | |
parent | 5b2cf5e651e4cfc087b7569a820135d5fd6c35ab (diff) | |
download | cpython-93bfe7d860644595eaf2bd5c9bf7db31ee4a4201.zip cpython-93bfe7d860644595eaf2bd5c9bf7db31ee4a4201.tar.gz cpython-93bfe7d860644595eaf2bd5c9bf7db31ee4a4201.tar.bz2 |
Issue #1470548: Do not buffer XMLGenerator output.
Add test for fragment producing with XMLGenerator.
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r-- | Lib/xml/sax/saxutils.py | 10 |
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): |