[issue27006] C implementation of Decimal.from_float() bypasses __new__ and __init__
Stefan Krah
report at bugs.python.org
Mon Jun 20 08:22:33 EDT 2016
Stefan Krah added the comment:
> PyDec_CheckExact(type) always return 0. Should be PyDec_CheckExact(result).
'result' is always an exact decimal, because your enum example won't work otherwise.
> And what about other calls of PyDecType_FromFloatExact()? Can they produce broken instance of Decimal subtype?
The PyDecType* functions handle calling the correct allocator, they don't handle calling __new__(). Why should they? The regular non-class-method enum examples worked.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27006>
_______________________________________
More information about the Python-bugs-list
mailing list