Skip to content

Commit c0c9796

Browse files
committed
Merge branch 'v0.12.x' of https://github.com/str4d/python-future into str4d-v0.12.x
2 parents 1a490fe + e19e01b commit c0c9796

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

future/builtins/misc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,25 @@
5959
from future.builtins.newnext import newnext as next
6060
from future.builtins.newround import newround as round
6161
from future.builtins.newsuper import newsuper as super
62+
from future.types.newint import newint
6263

6364
_SENTINEL = object()
6465

6566
def pow(x, y, z=_SENTINEL):
6667
"""
6768
pow(x, y[, z]) -> number
68-
69+
6970
With two arguments, equivalent to x**y. With three arguments,
7071
equivalent to (x**y) % z, but may be more efficient (e.g. for ints).
7172
"""
73+
# Handle newints
74+
if isinstance(x, newint):
75+
x = long(x)
76+
if isinstance(y, newint):
77+
y = long(y)
78+
if isinstance(z, newint):
79+
z = long(z)
80+
7281
try:
7382
if z == _SENTINEL:
7483
return _builtin_pow(x, y)

future/tests/test_builtins.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def __dir__(self):
639639
# raise IndexError
640640
# except:
641641
# self.assertEqual(len(dir(sys.exc_info()[2])), 4)
642-
#
642+
#
643643
# # test that object has a __dir__()
644644
# self.assertEqual(sorted([].__dir__()), dir([]))
645645

@@ -1271,9 +1271,9 @@ def test_pow(self):
12711271
self.assertAlmostEqual(pow(-2.,2), 4.)
12721272
self.assertAlmostEqual(pow(-2.,3), -8.)
12731273

1274-
for x in 2, 2.0:
1275-
for y in 10, 10.0:
1276-
for z in 1000, 1000.0:
1274+
for x in 2, int(2), 2.0:
1275+
for y in 10, int(10), 10.0:
1276+
for z in 1000, int(1000), 1000.0:
12771277
if isinstance(x, float) or \
12781278
isinstance(y, float) or \
12791279
isinstance(z, float):

0 commit comments

Comments
 (0)