-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
cython 3.0.11 compatibility #38500
cython 3.0.11 compatibility #38500
Conversation
Documentation preview for this PR (built with commit d943edc; changes) is ready! 🎉 |
Confirmed the problem with the upgrade PR #38501, https://github.com/sagemath/sage/actions/runs/10345037926/job/28631469828?pr=38501#step:9:12644 |
Fix confirmed using #38501 |
It is rather weird that only those cause problems out of the list of warnings I get. And there is a very clear cython 3.0.10 to 3.0.11 boundary as well. Something like that happening with say cython 3.1.0 would not have been so weird. |
see also #37885 (comment) |
It's a regression, see: cython/cython#6335 If this PR gets rid of every "implicit noexcept" warning, perhaps |
It does not, but I would consider finishing the job if there is not too much more to do. |
Actually, I should properly check what's left, maybe it will be a nice surprise. |
The whole of the
|
Once you remove duplicate warnings, it amounts to 15 lines, not too onerous
|
Actually this is not inside sage but the installed copy of cypari2. Does that prevent us from removing |
For cypari2 see #38183 |
I'd rather have proper release rather than rc, but that could be OK so long as we have final releases in time for 10.5. |
I held off with cutting the releases when I ran into #38183 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had noticed warnings about these files during building, which specifically mentioned a future lack of support of implicit noexcept
s.
Most such removals happened in #37667. After that, #38057 added many function return types. This combination for C
return types (int
, bint
, void
) seems to yield an issue.
|
Afaict, this was already fixed on version 2.1.5 of cypari2 (march 2024). |
Right, I am still on 2.1.4. I have let things slip a bit since some packages have been moved to the main gentoo tree. Time to put in some PR for Gentoo. |
But see, you have a problem here. As an example see https://github.com/sagemath/sage/blob/develop/src/sage/matroids/matroid.pyx#L495: ...
cpdef int _rank(self, frozenset X):
r"""
Return the rank of a set ``X``.
This method does no checking on ``X``, and ``X`` may be assumed to
have the same interface as ``frozenset``.
INPUT:
- ``X`` -- an object with Python's ``frozenset`` interface
OUTPUT: integer
.. NOTE::
Subclasses should implement this method.
EXAMPLES::
sage: M = sage.matroids.matroid.Matroid()
sage: M._rank(frozenset([0, 1, 2]))
NotImplementedError: subclasses need to implement this
...
"""
raise NotImplementedError("subclasses need to implement this")
... Since this function is indeed raising an exception, I don't think it should be Functions that return python types are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks @tornaria!
|
||
# internal methods, assuming verified input | ||
cpdef frozenset _max_independent(self, frozenset X) | ||
cpdef frozenset _circuit(self, frozenset X) | ||
cpdef frozenset _fundamental_circuit(self, frozenset B, e) | ||
cpdef frozenset _closure(self, frozenset X) | ||
cpdef int _corank(self, frozenset X) | ||
cpdef int _corank(self, frozenset X) noexcept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef int _corank(self, frozenset X) noexcept | |
cpdef int _corank(self, frozenset X) except -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget that one in your PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function does not raise an error, so I think better leave it as is.
src/sage/matroids/matroid.pyx
Outdated
@@ -492,7 +492,7 @@ cdef class Matroid(SageObject): | |||
""" | |||
raise NotImplementedError("subclasses need to implement this") | |||
|
|||
cpdef int _rank(self, frozenset X): | |||
cpdef int _rank(self, frozenset X) noexcept: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef int _rank(self, frozenset X) noexcept: | |
cpdef int _rank(self, frozenset X) except -1: |
src/sage/sets/disjoint_set.pxd
Outdated
@@ -19,8 +19,8 @@ cdef class DisjointSet_class(SageObject): | |||
cpdef number_of_subsets(self) | |||
|
|||
cdef class DisjointSet_of_integers(DisjointSet_class): | |||
cpdef int find(self, int i) | |||
cpdef void union(self, int i, int j) | |||
cpdef int find(self, int i) noexcept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef int find(self, int i) noexcept | |
cpdef int find(self, int i) except -1 |
src/sage/sets/disjoint_set.pxd
Outdated
cpdef int find(self, int i) | ||
cpdef void union(self, int i, int j) | ||
cpdef int find(self, int i) noexcept | ||
cpdef void union(self, int i, int j) noexcept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef void union(self, int i, int j) noexcept | |
cpdef void union(self, int i, int j) except * |
src/sage/sets/disjoint_set.pyx
Outdated
@@ -448,7 +448,7 @@ cdef class DisjointSet_of_integers(DisjointSet_class): | |||
for i, parent in enumerate(l): | |||
self.union(parent, i) | |||
|
|||
cpdef int find(self, int i): | |||
cpdef int find(self, int i) noexcept: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef int find(self, int i) noexcept: | |
cpdef int find(self, int i) except -1: |
src/sage/sets/disjoint_set.pyx
Outdated
@@ -492,7 +492,7 @@ cdef class DisjointSet_of_integers(DisjointSet_class): | |||
raise ValueError('i must be between 0 and %s (%s given)' % (card - 1, i)) | |||
return OP_find(self._nodes, i) | |||
|
|||
cpdef void union(self, int i, int j): | |||
cpdef void union(self, int i, int j) noexcept: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpdef void union(self, int i, int j) noexcept: | |
cpdef void union(self, int i, int j) except *: |
Yes, these are all (for the files in question). However, in order to make things build, the signatures of the heirs of the @kiwifb I opened a PR to your branch that settles everything. |
Thank you for that. |
After adding
I can personally ignore such ignorations. I am mostly insecure about whether these changes slow down |
Test with the update PR #38500 looks OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When you tag a function as If you want cython to use So, the warning you see means: the function returned I suggest reading http://docs.cython.org/en/latest/src/userguide/language_basics.html#error-return-values (click on "cython" to see the cython syntax which is used in sagemath .pyx files) If you want to support the possibility of having an implementation of these methods to return |
did you maybe miss my PR Mr. 🥝? kiwifb#2 |
I completely missed it. Good job poking me about it. |
Cool, didn't know that. Cute animal! |
…TRAINT=$SAGE_ROOT/constraints_pkgs.txt` <!-- ^^^^^ 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 is aimed at the intermediate level, for users who wish to build a set of distribution packages as supplied in `pkgs/` but without using the wheelhouse infrastructure of Sage-the-distribution. Documentation included in the files. It can also be tested using new tox environments defined in `pkgs/sagemath-standard/tox.ini`, and is tested on GH Actions: https://github.com/mkoeppe/sage/actions/workflows/ci-linux- incremental.yml?query=branch%3Aconstraints_pkgs - this also provides the missing automatic test for the **sagemath- standard** distribution built out of `pkgs/sagemath-standard/` Marked as critical because it is hoped to ease the adoption of modularized distribution packages by downstream packagers. <!-- 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. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - Depends on sagemath#38515 (merged here) - Depends on sagemath#38500 (merged here) URL: sagemath#37434 Reported by: Matthias Köppe Reviewer(s): François Bissey, Kwankyu Lee, Matthias Köppe
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> I recently installed cython 3.0.11 in Gentoo and it caused issue building sage. The issues are not present when building with cython 3.0.10. The fix is just to add some `noexcept` statements in some of the place cython complains about. More details of the issue and some of the error messages encountered at https://github.com/cschwan/sage-on- gentoo/issues/794 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. URL: sagemath#38500 Reported by: François Bissey Reviewer(s): François Bissey, gmou3, Matthias Köppe
…TRAINT=$SAGE_ROOT/constraints_pkgs.txt` <!-- ^^^^^ 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 is aimed at the intermediate level, for users who wish to build a set of distribution packages as supplied in `pkgs/` but without using the wheelhouse infrastructure of Sage-the-distribution. Documentation included in the files. It can also be tested using new tox environments defined in `pkgs/sagemath-standard/tox.ini`, and is tested on GH Actions: https://github.com/mkoeppe/sage/actions/workflows/ci-linux- incremental.yml?query=branch%3Aconstraints_pkgs - this also provides the missing automatic test for the **sagemath- standard** distribution built out of `pkgs/sagemath-standard/` Marked as critical because it is hoped to ease the adoption of modularized distribution packages by downstream packagers. <!-- 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. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - Depends on sagemath#38515 (merged here) - Depends on sagemath#38500 (merged here) URL: sagemath#37434 Reported by: Matthias Köppe Reviewer(s): François Bissey, Kwankyu Lee, Matthias Köppe
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Various bug fixes, preparation for Python 3.13 - https://cython.readthedocs.io/en/latest/src/changes.html#id2 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#38500 (merged here) URL: sagemath#38501 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Various bug fixes, preparation for Python 3.13 - https://cython.readthedocs.io/en/latest/src/changes.html#id2 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#38500 (merged here) URL: sagemath#38501 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
I recently installed cython 3.0.11 in Gentoo and it caused issue building sage. The issues are not present when building with cython 3.0.10. The fix is just to add some
noexcept
statements in some of the place cython complains about. More details of the issue and some of the error messages encountered at cschwan/sage-on-gentoo#794📝 Checklist