gh-38717: NotImplementedError when pow() called with modulus
<!-- ^ 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". -->
Many polynomial types silently ignore the modulus (third) argument of
`pow()`. For example,
```python
sage: R.<x> = PolynomialRing(ZZ)
sage: pow(x, 2, x)
x^2
```
This is true of `LaurentPolynomial`, `LaurentPolynomial_mpair`,
`MPolynomial_libsingular`, `Polynomial_integer_dense_flint`,
`Polynomial_rational_flint`, and `NCPolynomial_plural`. Ideally these
classes would implement this argument, but at the very least they should
raise `NotImplementedError` instead of giving an incorrect result.
URL: https://github.com/sagemath/sage/pull/38717
Reported by: Kyle Hofmann
Reviewer(s): Vincent Macri