From 3cb615c3b0cbe14177eedb59d417e4e59efa8826 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 27 May 2024 20:48:19 -0500 Subject: [PATCH] Make dim_type an arithmetic enum to preserve out==set - Closes gh-134 - Establish compatibility with nanobind 2, depend on 1.3 --- pyproject.toml | 2 +- src/wrapper/wrap_isl.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 291ea57..09808fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ requires = [ "wheel>=0.34.2", "cmake>=3.18", "scikit-build", - "nanobind", + "nanobind>=1.3", "ninja", "pcpp", ] diff --git a/src/wrapper/wrap_isl.cpp b/src/wrapper/wrap_isl.cpp index 4bb6d10..57af55c 100644 --- a/src/wrapper/wrap_isl.cpp +++ b/src/wrapper/wrap_isl.cpp @@ -107,7 +107,9 @@ NB_MODULE(_isl, m) .ENUM_VALUE(isl_stat_, ok) ; - py::enum_(m, "dim_type") + // Arithmetic (i.e. export numerical values) to ensure that out == set, as on + // the C side. + py::enum_(m, "dim_type", py::is_arithmetic()) .ENUM_VALUE(isl_dim_, cst) .ENUM_VALUE(isl_dim_, param) .value("in_", isl_dim_in)