gh-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 #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 #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: https://github.com/sagemath/sage/pull/38719
Reported by: Kyle Hofmann
Reviewer(s): Kyle Hofmann, Travis Scrimshaw