Project

Profile

Help

Bug #4416

closed

itemAt not downcasting to the lowest class/type in the hierarchy

Added by O'Neil Delpratt almost 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2020-01-06
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
1.2.1
Fixed in version:
11.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Reported by user: https://saxonica.plan.io/boards/4/topics/7743

The itemAt method in C++, PHP and Python does not downcast to the lowest class/type in the hierarchy.

Actions #1

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from New to In Progress

I have added code in the Python API to downcast the XdmItem to the minimum type possible. Added test cases.

Actions #2

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from In Progress to Resolved
Actions #3

Updated by Martin Honnen almost 5 years ago

Are the changes that are in https://dev.saxonica.com/repos/archive/opensource/latest9.9/hec/Saxon.C.API/python-saxon/saxonc.pyx the final changes and are tested?

When I use that file I run into cython errors:

Error compiling Cython file:
------------------------------------------------------------
...

        """
        cdef PyXdmValue val = None
        cdef PyXdmAtomicValue aval = None
        cdef PyXdmNode nval = None
        cdef PyXdmItem val = None // remove PyXdmItem()
                                           ^
------------------------------------------------------------

saxonc.pyx:3348:44: Syntax error in C variable declaration

If I try to fix that error by using cdef PyXdmItem val = None # remove PyXdmItem() I run into another error:

Error compiling Cython file:
------------------------------------------------------------
...
        cdef saxoncClasses.XdmItem * xdmItem = NULL
        xdmItem = self.thisvptr.itemAt(index)
        if xdmItem == NULL:
            return None
        else :
            cdef type_ = xdmItem.getType()
                ^
------------------------------------------------------------

saxonc.pyx:3354:17: cdef statement not allowed here

Using Python 3.7 and cython 0.29.14 on Windows 10.

Actions #4

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from Resolved to In Progress

I should not have marked this bug as resolved. I have fixed both issues in comment #3.

These changes are not tested as yet.

Actions #5

Updated by O'Neil Delpratt over 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 11.1

Testing completed.

Bug fix applied in the Saxon 11.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF