Skip to content
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

Mark all nanobind enums as nb::is_arithmetic() for compatibility with nanobind 2.x #825

Merged
merged 8 commits into from
May 11, 2024

Conversation

francesco-ballarin
Copy link
Member

Since wjakob/nanobind@d25bde8, conversion of a nanobind enum value to int is only allowed for enums marked with nb::is_arithmetic(), see for instance
wjakob/nanobind@d25bde8#diff-76fe099ab4bd5fcc25f3445a3de0b298c522bfbe4c877d60c64408b2e5cb2346L23
Conversion to integer is required by

return int(self.value)
, and would otherwise fail without the changes in this PR.

The changes in this PR are backward compatible, and thus it can be merged now without waiting for nanobind 2.0. Still, upon release of nanobind this PR will need to be backported to basix 0.8.1.
Tested against nanobind main branch in https://github.com/FEniCS/basix/actions/runs/9016093941, while tested against nanobind 1.9.x in https://github.com/FEniCS/basix/actions/runs/9016171285

@francesco-ballarin francesco-ballarin added nanobind Issues related to nanobindings backport? Suggest PR for backporting labels May 9, 2024
@francesco-ballarin francesco-ballarin requested a review from jhale May 11, 2024 06:17
@garth-wells garth-wells added this pull request to the merge queue May 11, 2024
Merged via the queue into main with commit e35ca08 May 11, 2024
27 checks passed
@garth-wells garth-wells deleted the francesco/intenum branch May 11, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport? Suggest PR for backporting nanobind Issues related to nanobindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants