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

Change wrapping of FLINT Z/nZ polynomial gcd failure #38719

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

kylehofmann
Copy link
Contributor

Sometimes FLINT fails to calculate GCDs in polynomial rings over Z/nZ. Since FLINT has no interface to report the failure, the GCD calculation needs to be wrapped and an error thrown. The present method of wrapping does not properly reactivate signals if an error happens, because the exception causes sig_off() to never be reached. This patch rectifies that. It also adds a doctest which triggers this code path; the example is designed so that the GCD exists but FLINT fails.

The error message is also adjusted, since the failure condition is more complicated than just encountering non-invertible elements (e.g., in Z/6, gcd(2*x, x) will work).

Copy link

github-actions bot commented Sep 27, 2024

Documentation preview for this PR (built with commit b7ae8b0; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two very minor things. Otherwise LGTM.

src/sage/libs/flint/nmod_poly_linkage.pxi Outdated Show resolved Hide resolved
src/sage/libs/flint/nmod_poly_linkage.pxi Outdated Show resolved Hide resolved
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.

3 participants