builtins.round fails if passed a decimal #501
Copy link
Copy link
Closed
Description
>>> round(Decimal('0.5'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".venv/lib/python2.7/site-packages/future/builtins/newround.py", line 42, in newround
d = Decimal.from_float(number).quantize(exponent,
File "/Users/tpict/.asdf/installs/python/2.7.16/lib/python2.7/decimal.py", line 690, in from_float
n, d = abs(f).as_integer_ratio()
AttributeError: 'Decimal' object has no attribute 'as_integer_ratio'
The newround function doesn't check if the input is of type Decimal before trying to convert it to one.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
jmadler commentedon Oct 17, 2019
Can you submit a bugfix please? I'll include it in a release in the next few days.
tpict commentedon Oct 22, 2019
Done!
jmadler commentedon Oct 24, 2019
Thanks! :)