mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211)
`x**y == 1/x**-y ` thus changing `/=` to `*=` by negating the exponent.
This commit is contained in:
parent
a4d4c1ede2
commit
f7bb658124
3 changed files with 8 additions and 1 deletions
|
|
@ -338,6 +338,11 @@ def test_pow(self):
|
|||
except OverflowError:
|
||||
pass
|
||||
|
||||
# gh-113841: possible undefined division by 0 in _Py_c_pow()
|
||||
x, y = 9j, 33j**3
|
||||
with self.assertRaises(OverflowError):
|
||||
x**y
|
||||
|
||||
def test_pow_with_small_integer_exponents(self):
|
||||
# Check that small integer exponents are handled identically
|
||||
# regardless of their type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue