Skip to content

Commit 8ef3ecc

Browse files
committed
Only wrap newints
1 parent 970ae0c commit 8ef3ecc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

future/builtins/misc.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,24 @@ def pow(x, y, z=_SENTINEL):
6969
With two arguments, equivalent to x**y. With three arguments,
7070
equivalent to (x**y) % z, but may be more efficient (e.g. for ints).
7171
"""
72+
# Handle newints
73+
if isinstance(x, float.builtins.int)
74+
x = long(x)
75+
if isinstance(y, float.builtins.int)
76+
y = long(y)
77+
if isinstance(z, float.builtins.int)
78+
z = long(z)
79+
7280
try:
7381
if z == _SENTINEL:
7482
return _builtin_pow(x, y)
7583
else:
76-
return _builtin_pow(long(x), long(y), long(z))
84+
return _builtin_pow(x, y, z)
7785
except ValueError:
7886
if z == _SENTINEL:
7987
return _builtin_pow(x+0j, y)
8088
else:
81-
return _builtin_pow(long(x+0j), long(y), long(z))
89+
return _builtin_pow(x+0j, y, z)
8290

8391
# ``future`` doesn't support Py3.0/3.1. If we ever did, we'd add this:
8492
# callable = __builtin__.callable

0 commit comments

Comments
 (0)