Comment 1 for bug 1857794

Revision history for this message
Chris Jerdonek (chris-jerdonek) wrote :

Here is the code for _Element.__delitem__():

https://github.com/lxml/lxml/blob/caf911e43194502c06f02be992abe9efd3fc19cd/src/lxml/etree.pyx#L766-L786

It looks like this issue might be because the "subelement" deletion case calls _removeText() in addition to _removeNode(), whereas the "slice" case only calls _removeNode():

https://github.com/lxml/lxml/blob/caf911e43194502c06f02be992abe9efd3fc19cd/src/lxml/apihelpers.pxi#L1168-L1175

I haven't confirmed for sure. It's just a difference I noticed when looking at the code superficially.