pybind11 raises a UnicodeDecodeError
on non-utf bytes in terms of sort Bytes
#1078
Labels
bindings
LLVM backend bindings to other languages
Terms of sort
Bytes
andString
are both stored in akore_string_pattern
in the AST library and treated the same way when being accessed from the bindings:llvm-backend/bindings/python/ast.cpp
Lines 360 to 363 in 2983a01
The issue here is when the
contents
property is accessed, pybind assumes it's a valid utf encoded string. This isn't always the case forBytes
terms, though, and an exception gets thrown in that case.Pybind does support returning an unconverted string, so we should find out how to do that for terms that need to be treated that way.
https://pybind11.readthedocs.io/en/stable/advanced/cast/strings.html#returning-c-strings-to-python
The text was updated successfully, but these errors were encountered: