-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-39350: Fix fractions for int subclasses #18375
Conversation
That's an alternative fix for https://bugs.python.org/issue39350 See PR #18309 to discussion (the other proposed fix). |
I tested manually that fractions.Fraction works again with numpy.int64: it works as expected. |
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.
The change LGTM, but we should make it clear in the Misc/NEWS entry that there's an actual behaviour change here from 3.8: it's not simply a case of a regression being introduced and then fixed.
@mdickinson: I completed the documentation, would you mind to review it? @mdickinson: You approved my PR. Does it mean that you are ok to always divide the numerator and denominator with an int, which is a Python 3.9 incompatible change? I'm fine with that, since I propose the change. But I prefer to confirm with you, since you proposed PR #18309 :-) |
Still LGTM, especially with the
@vstinner Yes, I'm personally fine with that change; I don't know how other interested parties might feel about it, and there seems a risk that people won't even notice that there's a behaviour change proposed and implemented without a dedicated b.p.o. issue. OTOH, I think it ought to be relatively uncontroversial, so perhaps we don't need that issue and discussion. |
Fix regression in fractions.Fraction if the numerator and/or the denominator is an int subclass.
I really liked the discussion :-) It was required to discuss how other types are handled. At the beginning, I didn't think about types other than int. At least, my PR now adds a test for an int subclass :-) |
Fix regression in fractions.Fraction if the numerator and/or the
denominator is an int subclass.
https://bugs.python.org/issue39350