bpo-39350: Fix fractions for int subclasses#18375
bpo-39350: Fix fractions for int subclasses#18375vstinner merged 1 commit intopython:masterfrom vstinner:fractions_int_subclass
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. |
mdickinson
left a comment
There was a problem hiding this comment.
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