New restriction on pow(x, y, z): If z is not None, x and y must be of

integer types, and y must be >= 0.  See discussion at
http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
This commit is contained in:
Tim Peters 2001-09-03 08:35:41 +00:00
parent 5d2b77cf31
commit 32f453eaa4
9 changed files with 79 additions and 49 deletions

View file

@ -314,10 +314,19 @@ def test_auto_overflow():
checkit(x, '**', y)
for z in special:
if z != 0:
expected = pow(longx, longy, long(z))
got = pow(x, y, z)
checkit('pow', x, y, '%', z)
if z != 0 :
if y >= 0:
expected = pow(longx, longy, long(z))
got = pow(x, y, z)
checkit('pow', x, y, '%', z)
else:
try:
pow(longx, longy, long(z))
except TypeError:
pass
else:
raise TestFailed("pow%r should have raised "
"TypeError" % ((longx, longy, long(z))))
# ---------------------------------------------------------------- do it