-
-
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
NotImplementedError when pow() called with modulus #38717
NotImplementedError when pow() called with modulus #38717
Conversation
Documentation preview for this PR (built with commit 188f93f; changes) is ready! 🎉 |
Sounds like a good idea but there's a significant code duplication going on… is there a way to eliminate that? (for example with function decoration, or if it's too slow, at least a utility function that can be called?) |
I also generally don't like duplicating code, but in this case, most of the duplication is in the unit tests. Those need to be near what they're testing, and they have minor differences because they test different classes. Except for those, the only duplicated code is two statements long (an |
One way to reduce the code duplication could be something like a @kylehofmann What's going on with the test failure in |
I don't know why that file's tests fail, but I believe it's not an issue with my code. You can find other MRs where the test process has failed, like #38748. When I test that file myself, or even when I run all tests, I don't get any errors. |
Yeah, I see a similar test failure in the PR you linked. I was concerned since the test failure was in a file you changed, but it seems to be a coincidence that you just happened to change a file where the CI is having issues. |
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
<!-- ^ 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". --> 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: sagemath#38717 Reported by: Kyle Hofmann Reviewer(s): Vincent Macri
<!-- ^ 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". --> 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: sagemath#38717 Reported by: Kyle Hofmann Reviewer(s): Vincent Macri
Many polynomial types silently ignore the modulus (third) argument of
pow()
. For example,This is true of
LaurentPolynomial
,LaurentPolynomial_mpair
,MPolynomial_libsingular
,Polynomial_integer_dense_flint
,Polynomial_rational_flint
, andNCPolynomial_plural
. Ideally these classes would implement this argument, but at the very least they should raiseNotImplementedError
instead of giving an incorrect result.