[Mlir-commits] [mlir] [MLIR][Python] fixup Context and Location stubs (PR #161433)

Maksim Levental llvmlistbot at llvm.org
Tue Sep 30 13:36:26 PDT 2025


================
@@ -3597,12 +3597,11 @@ void mlir::python::populateIRCore(nb::module_ &m) {
           },
           "Reports if the operation is attached to its parent block.")
       .def("erase", [](PyOperationBase &self) { self.getOperation().erase(); })
-      .def(
-          "walk", &PyOperationBase::walk, nb::arg("callback"),
-          nb::arg("walk_order") = MlirWalkPostOrder,
-          // clang-format off
-          nb::sig("def walk(self, callback: Callable[[Operation], WalkResult], walk_order: WalkOrder = " MAKE_MLIR_PYTHON_QUALNAME("ir.WalkOrder.POST_ORDER") ") -> None")
-          // clang-format on
+      .def("walk", &PyOperationBase::walk, nb::arg("callback"),
+           nb::arg("walk_order") = MlirWalkPostOrder,
+           // clang-format off
+          nb::sig("def walk(self, callback: Callable[[Operation], WalkResult], walk_order: WalkOrder) -> None")
----------------
makslevental wrote:

i removed the default val here because stubgen gets confused (for whatever reason) and tries to do `import WalkOrder` even though `WalkOrder` is defined at this point in the stub........... 🤷 

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


More information about the Mlir-commits mailing list