Skip to content

Commit

Permalink
Support NumPy's specialized int types in builtins.round
Browse files Browse the repository at this point in the history
  • Loading branch information
mnito committed Apr 6, 2020
1 parent ef51288 commit b4b54f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/future/builtins/newround.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def newround(number, ndigits=None):

exponent = Decimal('10') ** (-ndigits)

if PYPY:
# Work around issue #24: round() breaks on PyPy with NumPy's types
if 'numpy' in repr(type(number)):
number = float(number)
# Work around issue #24: round() breaks on PyPy with NumPy's types
# Also breaks on CPython with NumPy's specialized int types like uint64
if 'numpy' in repr(type(number)):
number = float(number)

if isinstance(number, Decimal):
d = number
Expand Down

0 comments on commit b4b54f0

Please sign in to comment.