Skip to content

[mlir][python] disable nanobind leak warnings #121099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

makslevental
Copy link
Contributor

@llvmbot
Copy link
Member

llvmbot commented Dec 25, 2024

@llvm/pr-subscribers-mlir

Author: Maksim Levental (makslevental)

Changes

See #119924 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/121099.diff

1 Files Affected:

  • (modified) mlir/lib/Bindings/Python/IRCore.cpp (+2)
diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index 86afa956398ae5..05c000bfd8ca0a 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -2587,6 +2587,8 @@ class PyOpAttributeMap {
 //------------------------------------------------------------------------------
 
 void mlir::python::populateIRCore(nb::module_ &m) {
+  // disable leak warnings which tend to be false positives.
+  nb::set_leak_warnings(false);
   //----------------------------------------------------------------------------
   // Enums.
   //----------------------------------------------------------------------------

Copy link
Contributor

@hawkinsp hawkinsp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with doing this. I've also found nanobind's leak checker to have false positives and have long disabled it in my projects: I don't even think CPython is guaranteed to call the destructor of every object on process shutdown.

@makslevental makslevental merged commit 08e2c15 into llvm:main Dec 29, 2024
10 checks passed
marbre added a commit to iree-org/llvm-project that referenced this pull request Jan 5, 2025
MaheshRavishankar added a commit to iree-org/llvm-project that referenced this pull request Jan 7, 2025
MaheshRavishankar added a commit to iree-org/llvm-project that referenced this pull request Jan 13, 2025
nirvedhmeshram pushed a commit to iree-org/llvm-project that referenced this pull request Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants