Xpath queries longer than app. 18000 characters/bytes yield an unknow error in versions of lxml
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
New
|
Undecided
|
Unassigned |
Bug Description
Xpath Queries longer than app. 18000 characters/bytes yield an unknown error at least in lxml version 4.8.0 and higher.
In earlier versions (at least 4.5.2 and lower) this error does not occur.
Python : sys.version_
lxml.etree : (4, 9, 1, 0)
libxml used : (2, 9, 12)
libxml compiled : (2, 9, 12)
libxslt used : (1, 1, 34)
libxslt compiled : (1, 1, 34)
Traceback (most recent call last):
File "D:\Dropbox\
main()
File "D:\Dropbox\
results = getresults(
File "D:\Dropbox\
noderesults = stree.xpath(
File "src\lxml\
File "src\lxml\
File "src\lxml\
lxml.etree.
The relevant Xpath queries are valid and work withoutany problem in other Xpath query evaluators and in earlier versions od lxml.
We use names for macros inside Xpath expressions. These are surrounded by %. We first expand these macros so that a full-fledged Xpath expression results. Below we give some data that suggest that a length > 18000 characters/bytes causes the problem
query length
//node[
//node[( %Tarsp_B_X_count% = 3)] 14938 ok
//node[
//node[( %declarative% )] 3239 ok
//node[( %Ond% )] 91 ok
I can send an Xpath query longer than 18k characters so that you can test yourself, but I do not know how to attach a file here.
Since this is a problem with Xpath, this might be a problem for libxml2 rather than lxml.
I look forward to a response.
shortest script to reproduce the error