This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sergey.Kirpichev
Recipients Sergey.Kirpichev, lemburg, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, terry.reedy
Date 2022-03-27.10:38:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648377499.05.0.677324684311.issue47079@roundup.psfhosted.org>
In-reply-to
Content
> It does not satisfy your assumptions in msg416056.

Yes, but does it fits to assumptions of the numbers module?  To be fair, there is even no requirement, that numerator/denominator are Integral instances (#25619 address also this).

BTW, it seems, the numpy integer types break my guess that numerator and denominator must have same types (I doubt that anyone uses numbers.Integral defaults, there are no tests for them in the CPython itself):
>>> a = numpy.int8(2); a
2
>>> type(a)
<class 'numpy.int8'>
>>> type(a.numerator)
<class 'numpy.int8'>
>>> type(a.denominator)
<class 'int'>
>>> type(a + a.denominator)
<class 'numpy.int64'>
>>> type(a.denominator + a)
<class 'numpy.int64'>
>>> type(a + a)
<class 'numpy.int8'>

If this is an expected behaviour for Integral types - feel free to close the bugreport.  Looks odd for me, however.
History
Date User Action Args
2022-03-27 10:38:19Sergey.Kirpichevsetrecipients: + Sergey.Kirpichev, lemburg, rhettinger, terry.reedy, mark.dickinson, stutzbach, serhiy.storchaka
2022-03-27 10:38:19Sergey.Kirpichevsetmessageid: <1648377499.05.0.677324684311.issue47079@roundup.psfhosted.org>
2022-03-27 10:38:19Sergey.Kirpichevlinkissue47079 messages
2022-03-27 10:38:18Sergey.Kirpichevcreate