[Mlir-commits] [mlir] [mlir][python] Small optimization to mlirApiObjectToCapsule. (PR #131160)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Mar 13 08:52:33 PDT 2025


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 2044dd07da99714bbeb801bafe6dd5179493fd48 f2e4e0bf758ee7d8b7351cfd810eb22df332ceb9 --extensions h -- mlir/include/mlir/Bindings/Python/NanobindAdaptors.h
``````````

</details>

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

``````````diff
diff --git a/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h b/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h
index 3d417b2c50..2dd35c097c 100644
--- a/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h
+++ b/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h
@@ -46,8 +46,8 @@ namespace detail {
 static nanobind::object mlirApiObjectToCapsule(nanobind::handle apiObject) {
   if (PyCapsule_CheckExact(apiObject.ptr()))
     return nanobind::borrow<nanobind::object>(apiObject);
-  nanobind::object api = nanobind::getattr(
-      apiObject, MLIR_PYTHON_CAPI_PTR_ATTR, nanobind::none());
+  nanobind::object api =
+      nanobind::getattr(apiObject, MLIR_PYTHON_CAPI_PTR_ATTR, nanobind::none());
   if (api.is_none()) {
     std::string repr = nanobind::cast<std::string>(nanobind::repr(apiObject));
     throw nanobind::type_error(

``````````

</details>


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


More information about the Mlir-commits mailing list