[XML-SIG] [ pyxml-Bugs-1064741 ] Spurious exceptions in xml.sax.drivers.drv_pyexpat

SourceForge.net noreply at sourceforge.net
Thu Nov 11 21:02:18 CET 2004


Bugs item #1064741, was opened at 2004-11-11 21:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1064741&group_id=6473

Category: SAX
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Miloslav Trmac (trmac)
Assigned to: Nobody/Anonymous (nobody)
Summary: Spurious exceptions in xml.sax.drivers.drv_pyexpat

Initial Comment:
Expat 1.95.7 is stricter about parsing state and
reports an error,
converted to an exception by pexpat, in Parse() if
parsing is already
done.

In the current (Nov 11 2004) CVS checkout, this happens in
xml.sax.drivers.drv_pyexpat.SAX_expat.close(): e.g
parseFile()
calls self.parser.Parse("", 1) and then calls self.close();
the following self.parser.Parse("", 0) throws an
ExpatException.

close() should probably check the current state and do the
"catch errors" Parse call only if parsing has not stopped.
Checking current state can be done using
XML_GetParsingStatus(),
which is apparently not available through pyexpat,
unfortunately.

The problem is easily reproducible by running the PyXML
testsuite;
test_marshal and test_saxdrivers fail, the tail of the
traceback being
e.g.
  File
"/home/mitr/PyXML-0.8.4/test/test_saxdrivers.py", line
64, in test_sax1
    parser.parseFile(open(findfile("test.xml")))
  File
"/usr/lib/python2.4/site-packages/_xmlplus/sax/drivers/drv_pyexpat.py",
line 74, in parseFile
    self.close()
  File
"/usr/lib/python2.4/site-packages/_xmlplus/sax/drivers/drv_pyexpat.py",
line 132, in close
    if self.parser.Parse("", 0) != 1:
ExpatError: parsing finished: line 116, column 0


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1064741&group_id=6473


More information about the XML-SIG mailing list