On Sun, Aug 17, 2008 at 10:40 AM, Edward K. Ream <[EMAIL PROTECTED]> wrote: > For Python 3.0b2 on Windows I don't see any test_xml_sax.py file in > Python30\Lib\test for b2. Do unit tests exist? >
Wrong name; it's test_sax. > While trying to bring up Leo, I found what looks like a bug that will cause > any byte stream to loop when calling xml.sax.parser.parse. My quick fix was > to change: > > while buffer != "": > > to: > > while buffer != "" and buffer != b"": > > at line 123 of xmlreader.py > > Here is the entire function: > > def parse(self, source): > from . import saxutils > source = saxutils.prepare_input_source(source) > > self.prepareParser(source) > file = source.getByteStream() > buffer = file.read(self._bufsize) > ### while buffer != "": > while buffer != "" and buffer != b"": ### EKR > self.feed(buffer) > buffer = file.read(self._bufsize) > self.close() > > For reference, here is the code in Leo that was hanging:: > > parser = xml.sax.make_parser() > parser.setFeature(xml.sax.handler.feature_external_ges,1) > # Include external general entities, esp. xml-stylesheet lines. > handler = saxContentHandler(c,inputFileName,silent,inClipboard) > parser.setContentHandler(handler) > ### theFile must be a byte stream? > ### hangs in a loop in xmlreader.py near line 124. > ### I hacked the code to fix it. > parser.parse(theFile) # expat does not support parseString > > In this case theFile is simply the result of open(filename,'r') Iirc, > attempting to speed up the parsing using various io.streams slowed things > down dramatically. Anyway, the code above works in Python 2.5. > Can you report this as a bug on the tracker, Edward? Otherwise this is just going to get lost. > Python26 -3 reports no errors in Leo, although several errors are reported > in tkinter and Pmw 1.3. > I have been working on silencing warnings in the stdlib. Hopefully I got the ones you found for tkinter. Otherwise you will find out in b3 and you can file a bug. =) -Brett _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com