This repository was archived by the owner on Oct 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
python/mlir/_mlir_libs/_mlir Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3442,6 +3442,14 @@ void mlir::python::populateIRCore(nb::module_ &m) {
34423442 return operation.createOpView ();
34433443 },
34443444 " Detaches the operation from its parent block." )
3445+ .def_prop_ro (
3446+ " attached" ,
3447+ [](PyOperationBase &self) {
3448+ PyOperation &operation = self.getOperation ();
3449+ operation.checkValid ();
3450+ return operation.isAttached ();
3451+ },
3452+ " Reports if the operation is attached to its parent block." )
34453453 .def (" erase" , [](PyOperationBase &self) { self.getOperation ().erase (); })
34463454 .def (" walk" , &PyOperationBase::walk, nb::arg (" callback" ),
34473455 nb::arg (" walk_order" ) = MlirWalkPostOrder);
Original file line number Diff line number Diff line change @@ -194,6 +194,13 @@ class _OperationBase:
194194 """
195195 Detaches the operation from its parent block.
196196 """
197+
198+ @property
199+ def attached (self ) -> bool :
200+ """
201+ Reports if the operation is attached to its parent block.
202+ """
203+
197204 def erase (self ) -> None : ...
198205
199206 @overload
You can’t perform that action at this time.
0 commit comments