mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
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:
parent
5d2b77cf31
commit
32f453eaa4
9 changed files with 79 additions and 49 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue