Skip to content

Commit 970ae0c

Browse files
committed
Wrap Python 2 pow(x, y, z) args in long() to protect from newints (issue #87)
1 parent d824e8b commit 970ae0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

future/builtins/misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@
6565
def pow(x, y, z=_SENTINEL):
6666
"""
6767
pow(x, y[, z]) -> number
68-
68+
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
"""
7272
try:
7373
if z == _SENTINEL:
7474
return _builtin_pow(x, y)
7575
else:
76-
return _builtin_pow(x, y, z)
76+
return _builtin_pow(long(x), long(y), long(z))
7777
except ValueError:
7878
if z == _SENTINEL:
7979
return _builtin_pow(x+0j, y)
8080
else:
81-
return _builtin_pow(x+0j, y, z)
81+
return _builtin_pow(long(x+0j), long(y), long(z))
8282

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

0 commit comments

Comments
 (0)