Project

Profile

Help

Bug #4349

closed

TypeError: expected bytes, str found in make_string_value

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

Status:
Closed
Priority:
Normal
Category:
Python
Start date:
2019-10-18
Due date:
% Done:

100%

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

Description

Reported here: https://saxonica.plan.io/boards/4/topics/7618

When building a PyXdmValue from a string we get the following error:

TypeError: expected bytes, str found

Bug fix applied in the make_string_value function of the class PySaxonProcessor. Add the following code to convert the Python str to a C char array:

        py_value_string = str_.encode('UTF-8') if str_ is not None else None
        cdef char * c_str_ = py_value_string if str_ is not None else ""

Added test case to the unit test cases.

Please register to edit this issue

Also available in: Atom PDF