diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 569ab15820e302..9cd74c88a3ccca 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -1601,5 +1601,12 @@ def test_square(self): self.assertEqual(n**2, (1 << (2 * bitlen)) - (1 << (bitlen + 1)) + 1) + def test_long_add_overallocate(self): + # see gh-100688 + x = (MASK//2) * (MASK+1) + x2 = (MASK//2 + 1) * (MASK+1) + z = x + x2 + self.assertEqual(x + x2, MASK * (MASK + 1)) + if __name__ == "__main__": unittest.main()