When
is added to trivial python code which uses lxml's etree.parse, the second etree.parse fails.
Let's have minimal XML file sf.xml containing
Let's have trivial code sf.py
from lxml import etree
# import xmlsec
xml1 = etree.parse("sf.xml")
print(xml1)
xml2 = etree.parse("sf.xml")
print(xml2)
Running it with python3 sf.py produces two objects:
<lxml.etree._ElementTree object at 0x7fe067e3ae88>
<lxml.etree._ElementTree object at 0x7fe067e3adc8>
However, when that import xmlsec is uncommented, the behaviour changes to
<lxml.etree._ElementTree object at 0x7fe8e2419548>
Traceback (most recent call last):
File "sf.py", line 5, in <module>
xml2 = etree.parse("sf.xml")
File "src/lxml/etree.pyx", line 3426, in lxml.etree.parse
File "src/lxml/parser.pxi", line 1840, in lxml.etree._parseDocument
File "src/lxml/parser.pxi", line 1866, in lxml.etree._parseDocumentFromURL
File "src/lxml/parser.pxi", line 1770, in lxml.etree._parseDocFromFile
File "src/lxml/parser.pxi", line 1163, in lxml.etree._BaseParser._parseDocFromFile
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 651, in lxml.etree._raiseParseError
This is with xmlsec that was installed via pip3 on Fedora 28:
# pip3 install xmlsec
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting xmlsec
Using cached https://files.pythonhosted.org/packages/35/42/d7cd323c91d4706f3cc32ffe7d5f851ab8ef9898ccb350f6ba593dd8b89a/xmlsec-1.3.3.tar.gz
Requirement already satisfied: pkgconfig in /usr/local/lib/python3.6/site-packages (from xmlsec)
Requirement already satisfied: lxml>=3.0 in /usr/lib64/python3.6/site-packages (from xmlsec)
Installing collected packages: xmlsec
Running setup.py install for xmlsec ... done
Successfully installed xmlsec-1.3.3
This is upstream version of Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1665459. With xmlsec installed via pip3 I don't get that segfault ... but note that the traceback ends with empty line, where some error message ("cannot parse file") would be expected.
When
is added to trivial python code which uses
lxml'setree.parse, the secondetree.parsefails.Let's have minimal XML file
sf.xmlcontainingLet's have trivial code
sf.pyRunning it with
python3 sf.pyproduces two objects:However, when that
import xmlsecis uncommented, the behaviour changes toThis is with
xmlsecthat was installed viapip3on Fedora 28:This is upstream version of Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1665459. With
xmlsecinstalled viapip3I don't get that segfault ... but note that the traceback ends with empty line, where some error message ("cannot parse file") would be expected.