lxml >= 5.1.1: SyntaxError: cannot use absolute path on element
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Low
|
scoder |
Bug Description
After updating to versions 5.1.1 and 5.2.0, our codebase encounters exceptions when using absolute paths with the iterfind method of an ElementTree object. This behavior deviates from the expected, where a FutureWarning should be logged instead of raising an exception directly.
Expected Behavior:
Absolute paths should trigger a FutureWarning indicating that absolute paths should not be used without interrupting the execution flow.
Actual Behavior:
A SyntaxError exception is raised, which prevents further execution of the script.
Affected Methods:
ElementTree.
Environment tested with:
Python version: 3.12.2
lxml versions: 5.1.1 and 5.2.0
Attachments:
Python script to reproduce the exception.
Steps to Reproduce:
Use the lxml library version 5.1.1 or 5.2.0.
Run the following Python script:
```python
from lxml import etree
xml_string = """
<concept>
<concept>
<concept>
</concept>
"""
root_tree = etree.fromstrin
root_tree.
```
Changed in lxml: | |
milestone: | 5.1.2 → 5.2.1 |
status: | Fix Committed → Fix Released |
Thanks, that was an update mistake.
Fixed in https:/ /github. com/lxml/ lxml/commit/ 9b8e36d4232aeef c24ce353b33d6b5 7d750166d3