2024-04-01 22:56:06 |
AustinMatherne |
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, and with find, findall, and iterfind methods of an Element 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.iterfind raises an exception when used with an absolute path.
Element.find, Element.findall, and Element.iterfind raise an exception when used with an absolute path.
Unaffected Methods:
ElementTree.find and ElementTree.findall do not raise an exception when used with an absolute path.
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>Content 1</concept>
<concept>Content 2</concept>
</concept>
"""
root = etree.fromstring(xml_string)
root.iterfind("//concept")
``` |
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.iterfind raises an exception when used with an absolute path.
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>Content 1</concept>
<concept>Content 2</concept>
</concept>
"""
root_tree = etree.fromstring(xml_string).getroottree()
root_tree.iterfind("//concept")
``` |
|