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

Update Cython to 3.0.0 #36054

Closed
wants to merge 44 commits into from
Closed

Conversation

infmagic2047
Copy link
Contributor

Here are the changes needed to get Sage compiled with Cython 3. Most of the commits involves renaming members from double-underscore to single-underscore or using fully-qualified names to refer to them (insight from @tornaria in #29863 (comment)). They should work just as fine with old Cython versions, and I could create a separate PR for them for easier review if desired. The rest of changes are specific to Cython 3 and likely does not work with older versions.

Some points worth noting:

  • I have got most tests passing, but there are still a few difficult ones remaining. I would like some help from those more experienced with the Sage internals.
  • I tried to limit the changes to Cython source files only (no *.py files), so hopefully it remains compatible with old pickles. The only exception is the __custom_name change, where I could not find a good way to keep compatibility.
  • A few Cython compiler directives are used, and I have not tried to reduce the scope of their usage. In particular, we should probably remove legacy_implicit_noexcept by adding noexcept to function declarations manually, but that can be done later.
  • Patches are included to get dependencies compiled with Cython 3. The patches for cysignals, cypari2, fpylll, and pplpy comes from python3-Cython: update to 3.0.1. void-linux/void-packages#45086. Scipy 1.10.x needs patches to compile with Cython 3, which can be dropped if we upgrade to 1.11.x (SciPy 1.11.x #35703).

Closes #29863.

📝 Checklist

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

⌛ Dependencies

@tornaria
Copy link
Contributor

I wonder if it would make sense to split this in two parts where the first (large) part involves all the method renaming since this will work fine with either cython 0.29 or 3, and leave the changes that force upgrading to cython 3 (if any) to a second (small) part that is easier to review, test, maintain, etc.

Ideally the same codebase should work on both cython 0.29 and 3, as it will take some time for distros to upgrade. If not possible, a small(ish) patch that we maintain as a PR here is good to ease adoption.

Maybe everything up to 4fefac1 is good as a first part, i.e. can be merged fine without updating cython, it seems it's all renaming methods in ways that won't change behaviour with old cython and makes supporting cython 3 easier.

I haven't yet found the time to actually try this, sorry.

@infmagic2047
Copy link
Contributor Author

Closed in favor of separate PRs #36109 and #36110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meta-ticket: Cython 3.0.0 (released July 2023)
3 participants