[Mlir-commits] [llvm] [mlir] [mlir python] Port Python core code to nanobind. (PR #118583)

Peter Hawkins llvmlistbot at llvm.org
Thu Dec 12 07:15:32 PST 2024


================
@@ -708,8 +843,8 @@ class PyDenseElementsAttribute
         std::string message;
         llvm::raw_string_ostream os(message);
         os << "Expected a static ShapedType for the shaped_type parameter: "
-           << py::repr(py::cast(*explicitType));
-        throw py::value_error(message);
+           << nb::cast<std::string_view>(nb::repr(nb::cast(*explicitType)));
----------------
hawkinsp wrote:

I admit I'm not 100% sure. The C++ language rules aren't exactly easy to understand here. I had assumed that they were, but I may be wrong. Happy to change these cases back to `std::string`, if you like.

https://github.com/llvm/llvm-project/pull/118583


More information about the Mlir-commits mailing list