-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-119189: Fix the fraction module so that __rpow__ works on arbitrary classes. #119242
gh-119189: Fix the fraction module so that __rpow__ works on arbitrary classes. #119242
Conversation
The fraction module implicitly casted float if __rpow__ was implemented in your class when raising a fraction to a power. Now it isn't done but will raise an exception if __rpow__ isn't implemented.
7d628e3
to
1de7a44
Compare
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.
Please update tests.
Also, I think that the text of the NEWS entry should be rewritten. It's hard to understand right now, I'm not even sure if it's correct at all.
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.
Please update tests and rewrite the NEWS entry.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Okay I will update tests. |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
Tests are still failing. You have to make them pass. |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
Misc/NEWS.d/next/Library/2024-05-20-13-48-37.gh-issue-119189.dhJVs5.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Added accidental removal of comment
I have made the requested changes; please review again. |
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
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. Thank you for your contribution @zitterbewegung.
Thanks @zitterbewegung for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @zitterbewegung for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
When using the ** operator or pow() with Fraction as the base and an exponent that is not rational, a float, or a complex, the fraction is no longer converted to a float. (cherry picked from commit b9965ef) Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
When using the ** operator or pow() with Fraction as the base and an exponent that is not rational, a float, or a complex, the fraction is no longer converted to a float. (cherry picked from commit b9965ef) Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
GH-119835 is a backport of this pull request to the 3.12 branch. |
GH-119836 is a backport of this pull request to the 3.13 branch. |
I consider this a bug fix. |
When using the ** operator or pow() with Fraction as the base and an exponent that is not rational, a float, or a complex, the fraction is no longer converted to a float.
When using the ** operator or pow() with Fraction as the base and an exponent that is not rational, a float, or a complex, the fraction is no longer converted to a float.
gh-119189: Fix the fraction module so that rpow works on arbitrary classes.