importing lxml.etree changes what exceptions are thrown by drv_libxml2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Triaged
|
Low
|
Unassigned |
Bug Description
Python : sys.version_
lxml.etree : (2, 3, 4, 0)
libxml used : (2, 7, 7)
libxml compiled : (2, 7, 8)
libxslt used : (1, 1, 26)
libxslt compiled : (1, 1, 26)
This bug is being tracked on two bug trackers:
FlexGet #1446 <http://
feedparser #352 <https:/
While investigating the tickets I found that, while libxml2 will normally throw a SAXParseException when it encounters an illformed character reference, merely importing lxml.etree causes libxml2 to throw a SAXException instead. I've created and attached a simple script to demonstrate the issue. The output from the script on my machine is:
Run #1 correct: SAXParseException was thrown
Run #2 INCORRECT: SAXException was thrown
lxml 2.4 (the latest github master) is going to fix at least some of the problems when using it together with libxml2's own Python bindings. I would be happy about some testing in that regard.
In general, it's safest to use a statically linked installation if both are going to be used together.