summaryrefslogtreecommitdiff
path: root/Lib/test/test_property.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_property.py')
-rw-r--r--Lib/test/test_property.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
index 26b7d5283a..f6f8f5ed0e 100644
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -3,6 +3,7 @@
import sys
import unittest
+from test import support
class PropertyBase(Exception):
pass
@@ -173,6 +174,16 @@ class PropertyTests(unittest.TestCase):
sub.__class__.spam.__doc__ = 'Spam'
self.assertEqual(sub.__class__.spam.__doc__, 'Spam')
+ @support.refcount_test
+ def test_refleaks_in___init__(self):
+ gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
+ fake_prop = property('fget', 'fset', 'fdel', 'doc')
+ refs_before = gettotalrefcount()
+ for i in range(100):
+ fake_prop.__init__('fget', 'fset', 'fdel', 'doc')
+ self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
+
+
# Issue 5890: subclasses of property do not preserve method __doc__ strings
class PropertySub(property):
"""This is a subclass of property"""