Bug #4352
Updated by O'Neil Delpratt about 5 years ago
The following sample code crashes out: ~~~ python with saxonc.PySaxonProcessor(license=False) as proc: print(proc.version) xquery_processor = proc.new_xquery_processor() result = xquery_processor.run_query_to_value(query_text = 'declare variable $n external := 10; (1 to $n)!(. * .)') print(result.size) for i in range(result.size): print(result.item_at(i)) ~~~ See error below: ~~~ Saxon/C 1.2.0 running with Saxon-HE 9.9.1.5J from Saxonica 10 1 JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR: system exception at 0x0000000000428b82 ~~~ The issue is we are not handling properly the case where the `XdmValue is a sequence. In the C++ code we are checking if the XdmValue is an instance of XdmNode or XdmtomicValue. But if it is neither of these types we just wrap the Java XdmValue object in the wrapper class in C++. This is no good in the case where the XdmValue contains a sequence value like a SequenceExtent object. In the Xslt30Processor object we handle this case by building sequence of items on the C++ side, size, but this code we are just not using in the XQueryProcessor. I have made the fix in the C++ code and the sample above works now. Testing for other places in the code which needs this fix.