[Mlir-commits] [mlir] [MLIR][Python] fix getOwner to return (typed) nb::object instead of abstract PyOpView (PR #165053)

Maksim Levental llvmlistbot at llvm.org
Sat Oct 25 11:14:21 PDT 2025


================
@@ -1187,3 +1187,16 @@ def callback(op):
         module.operation.walk(callback)
     except RuntimeError:
         print("Exception raised")
+
+
+# CHECK-LABEL: TEST: testGetOwnerConcreteOpview
+ at run
+def testGetOwnerConcreteOpview():
+    with Context() as ctx, Location.unknown():
+        module = Module.create()
+        with InsertionPoint(module.body):
+            a = arith.ConstantOp(value=42, result=IntegerType.get_signless(32))
+            r = arith.AddIOp(a, a, overflowFlags=arith.IntegerOverflowFlags.nsw)
+            for u in a.result.uses:
+                assert isinstance(u.owner, arith.AddIOp)
+            assert isinstance(r.operands[0].owner, arith.ConstantOp)
----------------
makslevental wrote:

this one fails 🤦 

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


More information about the Mlir-commits mailing list