summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-03-06 14:08:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-03-06 14:08:44 (GMT)
commita915723dc780f2c6753487795988fe3b75e140a9 (patch)
tree2d626badf25b8eaed82cf9dcf99a76b03f2611de /Lib/test
parentb5a23223f0def31c5e509fb9329cc5520c4552e3 (diff)
downloadcpython-a915723dc780f2c6753487795988fe3b75e140a9.zip
cpython-a915723dc780f2c6753487795988fe3b75e140a9.tar.gz
cpython-a915723dc780f2c6753487795988fe3b75e140a9.tar.bz2
fix potential refleak in PyFloat_AsDouble (closes #23590)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_float.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index e1e1f04..bd2d6c3 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -6,6 +6,7 @@ from test import support
import math
from math import isinf, isnan, copysign, ldexp
import operator
+import time
import random, fractions
INF = float("inf")
@@ -129,6 +130,11 @@ class GeneralFloatCases(unittest.TestCase):
self.assertRaises(TypeError, float, Foo4(42))
self.assertAlmostEqual(float(FooStr('8')), 9.)
+ class Foo5:
+ def __float__(self):
+ return ""
+ self.assertRaises(TypeError, time.sleep, Foo5())
+
def test_is_integer(self):
self.assertFalse((1.1).is_integer())
self.assertTrue((1.).is_integer())