[Mlir-commits] [mlir] [MLIR:Python] Fix race on PyOperations. (PR #139721)
Peter Hawkins
llvmlistbot at llvm.org
Wed May 14 08:33:29 PDT 2025
================
@@ -1638,12 +1728,17 @@ nb::object PyOperation::createOpView() {
return nb::cast(PyOpView(getRef().getObject()));
}
-void PyOperation::erase() {
+void PyOperation::eraseLocked() {
checkValid();
getContext()->clearOperationAndInside(*this);
mlirOperationDestroy(operation);
}
+void PyOperation::erase() {
+ nb::ft_lock_guard lock(getContext()->liveOperationsMutex);
+ eraseLocked();
+}
+
----------------
hawkinsp wrote:
Correct.
https://github.com/llvm/llvm-project/pull/139721
More information about the Mlir-commits
mailing list