summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-11-01 02:18:32 (GMT)
committerGitHub <noreply@github.com>2022-11-01 02:18:32 (GMT)
commitab575050709e2b313ca9a9585f09b6f4b0560318 (patch)
treeea50310d73da93ffad36bfeab28f760ed1926849 /Lib/test/test_math.py
parent88297e2a8a75898228360ee369628a4a6111e2ee (diff)
downloadcpython-ab575050709e2b313ca9a9585f09b6f4b0560318.zip
cpython-ab575050709e2b313ca9a9585f09b6f4b0560318.tar.gz
cpython-ab575050709e2b313ca9a9585f09b6f4b0560318.tar.bz2
GH-98897: fix memory leak if `math.dist` raises exception (GH-98898)
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index cfaf3b3..bf0d0a5 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1006,6 +1006,11 @@ class MathTests(unittest.TestCase):
self.assertEqual(math.dist(p, q), 5*scale)
self.assertEqual(math.dist(q, p), 5*scale)
+ def test_math_dist_leak(self):
+ # gh-98897: Check for error handling does not leak memory
+ with self.assertRaises(ValueError):
+ math.dist([1, 2], [3, 4, 5])
+
def testIsqrt(self):
# Test a variety of inputs, large and small.
test_values = (