On Thu, Nov 06, 2025 at 12:00:03PM +0000, Santiago Vila wrote:
parsel/selector.py:619:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/lxml/etree.pyx:1722: in lxml.etree._Element.xpath
   ???
src/lxml/xpath.pxi:290: in lxml.etree.XPathElementEvaluator.__call__
   ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

  ???
E   lxml.etree.XPathEvalError: Unregistered function: myfunc

src/lxml/xpath.pxi:210: XPathEvalError

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File 
"/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_parsel/build/parsel/selector.py", line 
619, in xpath
   result = xpathev(
       query,
   ...<2 lines>...
       **kwargs,
   )
 File "src/lxml/etree.pyx", line 1722, in lxml.etree._Element.xpath
 File "src/lxml/xpath.pxi", line 290, in 
lxml.etree.XPathElementEvaluator.__call__
 File "src/lxml/xpath.pxi", line 210, in 
lxml.etree._XPathEvaluatorBase._handle_result
lxml.etree.XPathEvalError: Unregistered function: myfunc

During handling of the above exception, another exception occurred:

ValueError: XPath error: Unregistered function: myfunc in myfunc()

During handling of the above exception, another exception occurred:

self = <test_xpathfuncs.XPathFuncsTestCase testMethod=test_set_xpathfunc>

   def test_set_xpathfunc(self) -> None:
       def myfunc(ctx: Any) -> None:
           myfunc.call_count += 1  # type: ignore[attr-defined]

       myfunc.call_count = 0  # type: ignore[attr-defined]

       body = """
       <p CLASS="foo">First</p>
       """
       sel = Selector(text=body)
      self.assertRaisesRegex(
           ValueError,
           "Unregistered function in myfunc",
           sel.xpath,
           "myfunc()",
       )
E       AssertionError: "Unregistered function in myfunc" does not match "XPath 
error: Unregistered function: myfunc in myfunc()"

I can reproduce this locally by building the package or by running the upstream test suite with `pytest` but not by running the upstream test suite with `tox`, I wonder what's the difference in the Debian lxml...

--
BR, wRAR

Attachment: signature.asc
Description: PGP signature

Reply via email to