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 Oren Milman
Recipients Oren Milman, belopolsky, serhiy.storchaka
Date 2017-08-28.18:23:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I guess you meant for me to check whether the following has any problem:
import decimal

class BadFloat(float):
    def as_integer_ratio(self):
        return 1 << 1000


so it doesn't crash.
if IIUC, this is because the C implementation of Decimal.from_float()
is PyDecType_FromFloat(), while the relevant part of it is a call to
But PyDecType_FromFloatExact() uses float.as_integer_ratio(), and thus
ISTM that the issue doesn't exist there.

(also, the following doesn't raise an exception, as expected:
import decimal

class BadFloat(float):
    def as_integer_ratio(self):
        raise RuntimeError

Date User Action Args
2017-08-28 18:23:31Oren Milmansetrecipients: + Oren Milman, belopolsky, serhiy.storchaka
2017-08-28 18:23:30Oren Milmansetmessageid: <>
2017-08-28 18:23:30Oren Milmanlinkissue31293 messages
2017-08-28 18:23:30Oren Milmancreate