Skip to content

Commit

Permalink
sagemathgh-36110: Update Cython to 3.0.2
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

This PR builds on sagemath#36109 and contains the rest of changes needed to
update Cython to 3.0.0. The actual changes needed for building Sage are
a632238 for the code,
67ad2e4 for the build system, and
7195b8f for the doctests. The rest of
commits are either from sagemath#36109 or for patching dependencies.

Closes sagemath#29863.

Ideally we should wait until numpy and scipy are upgraded to 1.25 and
1.11 respectively before merging this, so we can drop the patches for
them.

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

- Depends on sagemath#36109
- Depends on sagemath#36112 (merged here)

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36110
Reported by: Yutao Yuan
Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe, Tobias Diez
  • Loading branch information
Release Manager committed Sep 27, 2023
2 parents 5cef467 + cb78fd9 commit 05d7d1d
Show file tree
Hide file tree
Showing 32 changed files with 211 additions and 581 deletions.
32 changes: 32 additions & 0 deletions build/pkgs/cypari/patches/cython3-legacy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
commit 8ef356a4eb936c37f55a5c501f3a955e6740c0c5
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
Date: Wed Jul 19 19:45:23 2023 -0300

cython3 support using legacy directives

diff --git a/cypari2/gen.pyx b/cypari2/gen.pyx
index 247b1ad..75050a0 100644
--- a/cypari2/gen.pyx
+++ b/cypari2/gen.pyx
@@ -329,7 +329,7 @@ cdef class Gen(Gen_base):
>>> pari = Pari()
>>> L = pari("vector(10,i,i^2)")
>>> L.__iter__()
- <generator object at ...>
+ <...generator object at ...>
>>> [x for x in L]
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
>>> list(L)
diff --git a/setup.py b/setup.py
index 2188711..455337f 100755
--- a/setup.py
+++ b/setup.py
@@ -36,6 +36,8 @@ class build_ext(_build_ext):
"binding": True,
"cdivision": True,
"language_level": 2,
+ "legacy_implicit_noexcept": True,
+ "c_api_binop_methods": True,
}

_build_ext.finalize_options(self)
13 changes: 13 additions & 0 deletions build/pkgs/cysignals/patches/cython3-fix-warning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/cysignals/signals.pxd.in b/src/cysignals/signals.pxd.in
index c86e085..a98c8d1 100644
--- a/src/cysignals/signals.pxd.in
+++ b/src/cysignals/signals.pxd.in
@@ -54,7 +54,7 @@ cdef extern from "macros.h" nogil:
# can be used to make Cython check whether there is a pending exception
# (PyErr_Occurred() is non-NULL). To Cython, it will look like
# cython_check_exception() actually raised the exception.
-cdef inline void cython_check_exception() nogil except *:
+cdef inline void cython_check_exception() except * nogil:
pass


30 changes: 30 additions & 0 deletions build/pkgs/cysignals/patches/cython3-legacy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
commit 9996a4028ddc7f9a5ffda3df65d5b7d3b7df8aa5
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
Date: Wed Jul 19 18:34:57 2023 -0300

cython3 support using legacy directives

diff --git a/setup.py b/setup.py
index 37acdfc..f68270b 100755
--- a/setup.py
+++ b/setup.py
@@ -157,13 +157,17 @@ class build_ext(_build_ext):
# Run Cython with -Werror on continuous integration services
# with Python 3.6 or later
from Cython.Compiler import Options
- Options.warning_errors = True
+ Options.warning_errors = False

from Cython.Build.Dependencies import cythonize
return cythonize(extensions,
build_dir=cythonize_dir,
include_path=["src", os.path.join(cythonize_dir, "src")],
- compiler_directives=dict(binding=True, language_level=2))
+ compiler_directives=dict(
+ binding=True,
+ language_level=2,
+ legacy_implicit_noexcept=True,
+ ))


class build_py(_build_py):
6 changes: 3 additions & 3 deletions build/pkgs/cython/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=Cython-VERSION.tar.gz
sha1=762987c737acfe7532cb3da38b450fb6e0cf1d7b
md5=a4d0f9fbc9c137f1a88937cd40e8c5ee
cksum=2260471737
sha1=08eb99f7c95b7ca667b1547575e7369d8064b4b3
md5=00def3f2b96c393098e01eb2f1f169ad
cksum=2321746451
upstream_url=https://pypi.io/packages/source/C/Cython/Cython-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/cython/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| $(PYTHON_TOOLCHAIN) $(PYTHON)
| $(PYTHON_TOOLCHAIN) $(PYTHON) pythran

----------
All lines of this file are ignored except the first.
2 changes: 1 addition & 1 deletion build/pkgs/cython/install-requires.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cython >=0.29.21, <1.0
cython >=3.0, <4.0
2 changes: 1 addition & 1 deletion build/pkgs/cython/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.29.36
3.0.2
Loading

0 comments on commit 05d7d1d

Please sign in to comment.