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:
Sergey B Kirpichev 2024-11-24 10:37:37 +03:00 committed by GitHub
parent a4d4c1ede2
commit f7bb658124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View file

@ -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.