[Mlir-commits] [mlir] [mlir][python] value casting (PR #69644)

Maksim Levental llvmlistbot at llvm.org
Tue Oct 31 13:29:08 PDT 2023


================
@@ -1124,6 +1122,8 @@ class PyValue {
   /// Gets a capsule wrapping the void* within the MlirValue.
   pybind11::object getCapsule();
 
+  virtual pybind11::object maybeDownCast();
----------------
makslevental wrote:

> Do need py::cast to work for these?

You need the `py::cast` in there so that you're returning a single type `py::object` (like the casters return) instead of `py::object | PyValue`. But it's moot because it works with the virtual destructor just the same.

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


More information about the Mlir-commits mailing list