[Mlir-commits] [mlir] [MLIR][Python] make Sliceable inherit from Sequence (PR #170551)

Maksim Levental llvmlistbot at llvm.org
Thu Dec 4 14:02:01 PST 2025


================
@@ -344,7 +346,16 @@ class Sliceable {
 
   /// Binds the indexing and length methods in the Python class.
   static void bind(nanobind::module_ &m) {
-    auto clazz = nanobind::class_<Derived>(m, Derived::pyClassName)
+    const std::type_info &elemTy = typeid(ElementTy);
+    PyObject *elemTyInfo = nanobind::detail::nb_type_lookup(&elemTy);
+    assert(elemTyInfo &&
+           "expected nb_type_lookup to succeed for Sliceable elemTy");
----------------
makslevental wrote:

There's no way for this to fail - the `ElementTy` needs to be registered before `Sliceable[ElementTy]` can be registered...

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


More information about the Mlir-commits mailing list