[Mlir-commits] [mlir] WIP: [mlir:python] Fix crash in `from_python` on multiple overloads (PR #191764)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Apr 12 23:50:50 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- mlir/include/mlir/Bindings/Python/NanobindAdaptors.h mlir/test/python/lib/PythonTestModuleNanobind.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/test/python/lib/PythonTestModuleNanobind.cpp b/mlir/test/python/lib/PythonTestModuleNanobind.cpp
index 4a794872c..76c0c2f0d 100644
--- a/mlir/test/python/lib/PythonTestModuleNanobind.cpp
+++ b/mlir/test/python/lib/PythonTestModuleNanobind.cpp
@@ -168,12 +168,10 @@ NB_MODULE(_mlirPythonTestNanobind, m) {
   //   2. PyErr is clear → overload 2 succeeds → returns "module".
   m.def(
       "take_module_or_operation",
-      [](MlirOperation) { return std::string("operation"); },
-      nb::arg("arg"));
+      [](MlirOperation) { return std::string("operation"); }, nb::arg("arg"));
   m.def(
       "take_module_or_operation",
-      [](MlirModule) { return std::string("module"); },
-      nb::arg("arg"));
+      [](MlirModule) { return std::string("module"); }, nb::arg("arg"));
 
   using namespace python_test;
   PyTestAttr::bind(m);

``````````

</details>


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


More information about the Mlir-commits mailing list