Skip to content

Commit 11b3870

Browse files
committed
maint: make python-flint work with Cython 3.2
Followup and proper fix after flintlib#337
1 parent 83979e2 commit 11b3870

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,16 @@ Compatible versions:
144144

145145
| python-flint | Release date | CPython | FLINT | Cython |
146146
|--------------|---------------|-------------|------------|------------------|
147+
| `0.9.0` | ??? | `3.11-3.14` | `3.0-3.3` | `3.1-3.2?` |
147148
| `0.8.0` | 29th Aug 2025 | `3.11-3.14` | `3.0-3.3` | `3.1` only |
148149
| `0.7.0` | 16th Mar 2025 | `3.11-3.13` | `3.0-3.2` | `3.0.11-3.1.0a1` |
149150
| `0.6.0` | 1st Feb 2024 | `3.9-3.12` | `3.0` only | `3.0` only |
150151

151152
The requirement for Cython 3.1 is only for CPython's free-threaded build.
152-
Otherwise Cython 3.0 is fine. As of python-flint 0.7.0, CPython 3.13 [PEP
153+
Otherwise Cython 3.0 is fine. Cython 3.2 is required for a stable ABI build of
154+
python-flint.
155+
156+
As of python-flint 0.7.0, CPython 3.13 [PEP
153157
703](https://peps.python.org/pep-0703/) free-threaded (no-GIL) builds of
154158
python-flint are provided. In the the free-threaded build, mutating matrices or
155159
polynomials from multiple threads can lead to memory corruption. There are some

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ project(
1515
flint_lower = '>=3.0'
1616
flint_upper = '<3.4'
1717
cython_lower = '>=3.0.11'
18-
cython_upper = '<3.2'
18+
cython_upper = '<3.3'
1919

2020
py = import('python').find_installation(pure: false)
2121
dep_py = py.dependency()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ content-type = "text/markdown"
4141
# fine. It is not possible to have a separate version constraint here for the
4242
# freethreading build only though.
4343
#
44-
requires = ["meson-python >= 0.18", "cython >=3.1,<3.2"]
44+
requires = ["meson-python >= 0.18", "cython >=3.1,<3.3"]
4545
build-backend = "mesonpy"
4646

4747
[tool.meson-python]

src/flint/types/_gr.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,11 @@ cdef class gr_ctx(flint_ctx):
602602
###
603603
# Square Roots
604604

605-
def is_square(self, x):
605+
def is_square(self, x) -> bool | None:
606606
"""
607607
Returns whether x is a perfect square in the context.
608608
"""
609-
return self._is_square(self(x))
609+
return truth_to_py(self._is_square(self(x)))
610610

611611
def sqrt(self, x) -> gr:
612612
"""
@@ -1912,7 +1912,7 @@ cdef class gr(flint_scalar):
19121912
>>> Q(4).sqrt()
19131913
2
19141914
"""
1915-
return truth_to_py(self.ctx.is_square(self))
1915+
return self.ctx.is_square(self)
19161916

19171917
def sqrt(self):
19181918
"""Return the square root of the element if it exists.

0 commit comments

Comments
 (0)