From 2b30b4faba2b28119d91f69f2423a1c141dfedd9 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 30 Oct 2025 14:50:10 +0000 Subject: [PATCH 1/3] fix: cython 3.2 compatibility --- bin/coverage.sh | 2 +- src/flint/types/_gr.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/coverage.sh b/bin/coverage.sh index 651497b2..96058172 100755 --- a/bin/coverage.sh +++ b/bin/coverage.sh @@ -18,7 +18,7 @@ pip uninstall -y cython pip install --pre cython # unpinned to pick up new releases in CI # pip install cython==3.1.0a1 # known working version for Python < 3.13 -meson setup build -Dcoverage=true +meson setup build -Dcoverage=true -Dflint_version_check=false spin run -- coverage run $RC -m flint.test $@ coverage report $RC -m --sort=cover coverage html $RC diff --git a/src/flint/types/_gr.pyx b/src/flint/types/_gr.pyx index f1a2a13e..1c8c590b 100644 --- a/src/flint/types/_gr.pyx +++ b/src/flint/types/_gr.pyx @@ -602,7 +602,7 @@ cdef class gr_ctx(flint_ctx): ### # Square Roots - def is_square(self, x) -> bool | None: + def is_square(self, x): """ Returns whether x is a perfect square in the context. """ From b47698a4f173dbbdd7fb4421c6b3892978fcf62b Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 30 Oct 2025 14:55:00 +0000 Subject: [PATCH 2/3] Use set comprehension --- src/flint/flint_base/flint_base.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flint/flint_base/flint_base.pyx b/src/flint/flint_base/flint_base.pyx index 70e4d696..caf6e8ef 100644 --- a/src/flint/flint_base/flint_base.pyx +++ b/src/flint/flint_base/flint_base.pyx @@ -474,7 +474,7 @@ cdef class flint_mpoly_context(flint_elem): fmpz_mpoly_ctx(3, '', ('y', 'z', 'b')) """ nvars = self.nvars() - gen_idxs = set(self.variable_to_index(i) for i in gens) + gen_idxs = {self.variable_to_index(i) for i in gens} if len(gens) > nvars: raise ValueError(f"expected at most {nvars} unique generators, got {len(gens)}") From 0795d719166f90268af3361e8f33bff2e79be280 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 30 Oct 2025 15:23:47 +0000 Subject: [PATCH 3/3] Don't import Self in Python < 3.11 --- src/flint/typing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/flint/typing.py b/src/flint/typing.py index 5e6e1136..11c71180 100644 --- a/src/flint/typing.py +++ b/src/flint/typing.py @@ -10,12 +10,14 @@ Iterator, Iterable, Any, - Self, Mapping, Sequence, overload, ) +if TYPE_CHECKING: + from typing import Self + from .flint_base.flint_base import ( flint_elem, flint_scalar,