Project

Profile

Help

Bug #5270

closed

NameError: name 'derivedaaptr' is not defined

Added by O'Neil Delpratt about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Python
Start date:
2022-02-03
Due date:
% Done:

100%

Estimated time:
Found in version:
11.1
Fixed in version:
11.2
Platforms:

Description

Reported by user in the following forum posts:

https://saxonica.plan.io/boards/4/topics/8468 and https://saxonica.plan.io/boards/4/topics/8465

The as_list() and array_length() method on the PyXdmArray when called throws the following error:

from saxonc import *

with PySaxonProcessor(license=False) as proc:
    print("Test SaxonC on Python")
    print(proc.version)
    
    list1 = [1,2,3]
    
    print(list1)
    
    xdmValueList1 = [proc.make_integer_value(i) for i in list1]
    
    print(xdmValueList1)
    
    xdmArray1 = proc.make_array(xdmValueList1)
    
    print(isinstance(xdmArray1, PyXdmArray))
    
    list1FromXdmArray = xdmArray1.as_list()

Error:

Traceback (most recent call last):
  File "martin_example2.py", line 20, in <module>
    list1FromXdmArray = xdmArray1.as_list()
  File "saxonc.pyx", line 4495, in saxonc.PyXdmArray.as_list
    count = derivedaaptr.arity()
NameError: name 'derivedaaptr' is not defined
Actions #1

Updated by O'Neil Delpratt about 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Bug fix applied in the saxonc.pyx file.

The arrayLength and arity methods are missing the keyword self before derivedaaptr.

Also in the as_list method the use of arity is wrong. It should be as follows:

count = self.derivedaaptr.arrayLength()
Actions #2

Updated by O'Neil Delpratt about 2 years ago

Bug fix available in the next release. As a workaround patches can be applied to the saxonc.pyx file.

Actions #3

Updated by Martin Honnen about 2 years ago

Thanks, O'Neil. Would you mind attaching the patched saxonc.pyx to the bug issue? Or is there a public Git repository that shows the actual open source HE 11.1 C/C++/Python sources?

Actions #4

Updated by O'Neil Delpratt about 2 years ago

Martin Honnen wrote:

Thanks, O'Neil. Would you mind attaching the patched saxonc.pyx to the bug issue? Or is there a public Git repository that shows the actual open source HE 11.1 C/C++/Python sources?

I will review what is possible and get back to you. as there will be a few bug fixes to go in.

Actions #5

Updated by Debbie Lockett about 2 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 11.2

Bug fix applied in the Saxon 11.2 maintenance release.

Please register to edit this issue

Also available in: Atom PDF