Skip to content

Commit b4b54f0

Browse files
committed
Support NumPy's specialized int types in builtins.round
1 parent ef51288 commit b4b54f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/future/builtins/newround.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def newround(number, ndigits=None):
3232

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

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

4040
if isinstance(number, Decimal):
4141
d = number

0 commit comments

Comments
 (0)