Launchpad

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.fromstrin g(xml_string) .getroottree( )
root_tree. iterfind( "//concept" )

```

Read the original on bugs.launchpad.net ↗