Project

Profile

Help

Bug #5298

closed

TypeError: __str__ returned non-string (type NoneType)

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

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

100%

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

Description

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

The property PyXdmItem.head fails to return the underlying PyXdmMap object and throws the following error:

Traceback (most recent call last):
  File "C:\Users\marti\OneDrive\Documents\xslt\blog-xslt-3-by-example\saxonc-11.1-python\arrays-and-maps\returnXdmMapFromXsltTest1.py", line 48, in <module>
    print(result1)
TypeError: __str__ returned non-string (type NoneType)
Actions #1

Updated by O'Neil Delpratt over 2 years ago

The Underlying C++ API for XPathProcessor is wrong. We check for instance of XdmFunctionItem before checking the subclasses first: i.e. XdmMap and XdmArray. The XQueryProcessor has the correct logic.

I have fixed this in the C++ code. Now investigating the failure of the toString method

Actions #2

Updated by O'Neil Delpratt over 2 years ago

The _ str _ on the XdmMap calls the C++ method getStringValue() which is the same as applying the XPath string() function. This is undefined for an XdmMap. I have made a change for the _ str _ property to call toString() method which would be more useful

Actions #3

Updated by O'Neil Delpratt over 2 years ago

  • Status changed from New to Resolved

Bug fixed and available for maintenance release.

Actions #4

Updated by O'Neil Delpratt over 2 years ago

  • % Done changed from 0 to 100
Actions #5

Updated by Debbie Lockett over 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