Previously, this API would return the PyObjectRef, rather than the
underlying PyOperation.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D101416
mlirOperationEqual(self.getParentOperation()->get(),
mlirOpResultGetOwner(self.get())) &&
"expected the owner of the value in Python to match that in the IR");
- return self.getParentOperation();
+ return self.getParentOperation().getObject();
});
c.def_property_readonly("result_number", [](PyOpResult &self) {
return mlirOpResultGetResultNumber(self.get());
run(testCapsuleConversions)
+
+
+# CHECK-LABEL: TEST: testOpResultOwner
+def testOpResultOwner():
+ ctx = Context()
+ ctx.allow_unregistered_dialects = True
+ with Location.unknown(ctx):
+ i32 = IntegerType.get_signless(32)
+ op = Operation.create("custom.op1", results=[i32])
+ assert op.result.owner == op
+
+
+run(testOpResultOwner)