Project

Profile

Help

Bug #6333

open

Representing empty sequence

Added by O'Neil Delpratt 3 months ago. Updated 3 months ago.

Status:
In Progress
Priority:
Normal
Category:
Saxon-C Internals
Start date:
2024-01-29
Due date:
% Done:

0%

Estimated time:
Found in version:
12.4.2
Fixed in version:
Platforms:

Description

SaxonC currently does not properly represent empty sequences via the API. What we need is an XdmEmptySequence class similar to its Java counterpart. Moreover, In SaxonJ (Java) an empty XdmValue is also an empty sequence which can be passed as a parameter to an expression of stylesheet, but this fails in SaxonC.

For example:

    xp = saxonproc.new_xpath_processor()
    xp.declare_namespace("fn", "http://www.w3.org/2005/xpath-functions")
    xp.declare_variable('p')
    xdm_value = PyXdmValue()
    xp.set_parameter('p', xdm_value)
    assert xp.effective_boolean_value("fn:empty($p)")

Crashes out with the following exception:

java.lang.IllegalArgumentException: Invalid handle
    at com.oracle.svm.core.handles.ObjectHandlesImpl.doGet(ObjectHandlesImpl.java:232)
    at com.oracle.svm.core.handles.ObjectHandlesImpl.get(ObjectHandlesImpl.java:220)
    at net.sf.saxon.option.cpp.ProcessorDataAccumulator.addProcessorDataPair(ProcessorDataAccumulator.java:93)

This is probably because the empty PyXdmValue() object is not internally getting converted to an empty sequence.


Related issues

Related to SaxonC - Bug #6327: TypeError: __str__ returned non-string (type NoneType)ResolvedO'Neil Delpratt2024-01-192024-01-19

Actions
Actions #1

Updated by O'Neil Delpratt 3 months ago

The example result = xp.evaluate_single("(1,2,3)[10]") in SaxonC Python currently returns None because the result is an empty sequence. In Java this would be XdmEmptySequence.

Actions #2

Updated by O'Neil Delpratt 3 months ago

  • Related to Bug #6327: TypeError: __str__ returned non-string (type NoneType) added
Actions #3

Updated by O'Neil Delpratt 3 months ago

  • Status changed from New to In Progress

Committed a partial fix to solve the Invalid handle error. We now handle the empty PyXdmValue() as an empty sequence.

Please register to edit this issue

Also available in: Atom PDF