[Mlir-commits] [mlir] [mlir][python] Add stable ABI (abi3) support (PR #183856)

Maksim Levental llvmlistbot at llvm.org
Sat Feb 28 09:29:44 PST 2026


================
@@ -1877,7 +1876,8 @@ MLIR_PYTHON_API_EXPORTED void populateRoot(nanobind::module_ &m);
 template <class Func, typename... Args>
 inline nanobind::object classmethod(Func f, Args... args) {
   nanobind::object cf = nanobind::cpp_function(f, args...);
-  return nanobind::borrow<nanobind::object>((PyClassMethod_New(cf.ptr())));
+  nanobind::object builtins = nanobind::module_::import_("builtins");
----------------
makslevental wrote:

In nanobindadaptors we have a way of caching these imports 

https://github.com/llvm/llvm-project/blob/2430410b7d879fce3db76c21bb8c60ed22abd0b5/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h#L74

Can you use it for this import

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


More information about the Mlir-commits mailing list