if isinstance(x, float) or \
isinstance(y, float) or \
isinstance(z, float):
- self.assertRaises(TypeError, pow, x, y, z)
+ self.assertRaises(ValueError, pow, x, y, z)
else:
self.assertAlmostEqual(pow(x, y, z), 24.0)
Case Roole
Timothy Roscoe
Erik Rose
+Josh Rosenberg
Jim Roskind
Brian Rosner
Guido van Rossum
Core and Builtins
-----------------
+- Issue #21193: pow(a, b, c) now raises ValueError rather than TypeError when b
+ is negative. Patch by Josh Rosenberg.
+
- PEP 465 and Issue #21176: Add the '@' operator for matrix multiplication.
- Issue #21134: Fix segfault when str is called on an uninitialized
if (Py_SIZE(b) < 0) { /* if exponent is negative */
if (c) {
- PyErr_SetString(PyExc_TypeError, "pow() 2nd argument "
+ PyErr_SetString(PyExc_ValueError, "pow() 2nd argument "
"cannot be negative when 3rd argument specified");
goto Error;
}