-
-
Notifications
You must be signed in to change notification settings - Fork 711
Change wrapping of FLINT Z/nZ polynomial gcd failure #38719
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
Conversation
|
Documentation preview for this PR (built with commit b7ae8b0; changes) is ready! 🎉 |
a67bebe to
24fc9a2
Compare
tscrim
left a 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.
Two very minor things. Otherwise LGTM.
Co-authored-by: Travis Scrimshaw <[email protected]>
Co-authored-by: Travis Scrimshaw <[email protected]>
tscrim
left a 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.
Thank you. Positive review.
sagemathgh-38719: Change wrapping of FLINT Z/nZ polynomial gcd failure <!-- ^ 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". --> 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). URL: sagemath#38719 Reported by: Kyle Hofmann Reviewer(s): Kyle Hofmann, Travis Scrimshaw
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).