diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2024-11-24 10:37:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-23 23:37:37 -0800 |
commit | f7bb658124aba74be4c13f498bf46cfded710ef9 (patch) | |
tree | be3f2fdeda629af39f82d9911dc54f2717bfa60b /Lib/test/test_complex.py | |
parent | a4d4c1ede21f9fa72280f4fc0f50212eecfac9ae (diff) | |
download | cpython-f7bb658124aba74be4c13f498bf46cfded710ef9.tar.gz cpython-f7bb658124aba74be4c13f498bf46cfded710ef9.zip |
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.
Diffstat (limited to 'Lib/test/test_complex.py')
-rw-r--r-- | Lib/test/test_complex.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index ecc97315e50..c51327c7f33 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -338,6 +338,11 @@ class ComplexTest(ComplexesAreIdenticalMixin, unittest.TestCase): 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. |