summaryrefslogtreecommitdiff
path: root/Lib/xml/sax/xmlreader.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-02 21:00:13 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-02 21:00:13 +0300
commit61de087f0f838f5b69592827d3d592c06aa9b655 (patch)
tree302f1a8799a529de0213a395e30fb4705b53f6bf /Lib/xml/sax/xmlreader.py
parent278ba2690c9367d36f138c880130aa1390fbaa19 (diff)
downloadcpython-git-61de087f0f838f5b69592827d3d592c06aa9b655.tar.gz
Issue #2175: SAX parsers now support a character stream of InputSource object.
Diffstat (limited to 'Lib/xml/sax/xmlreader.py')
-rw-r--r--Lib/xml/sax/xmlreader.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/xml/sax/xmlreader.py b/Lib/xml/sax/xmlreader.py
index 7ef497f94f..716f228404 100644
--- a/Lib/xml/sax/xmlreader.py
+++ b/Lib/xml/sax/xmlreader.py
@@ -117,7 +117,9 @@ class IncrementalParser(XMLReader):
source = saxutils.prepare_input_source(source)
self.prepareParser(source)
- file = source.getByteStream()
+ file = source.getCharacterStream()
+ if file is None:
+ file = source.getByteStream()
buffer = file.read(self._bufsize)
while buffer:
self.feed(buffer)