summaryrefslogtreecommitdiff
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index d24d005ccf..0e7728ebf2 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1559,6 +1559,15 @@ order (MRO) for bases """
del cm.x
self.assertNotHasAttr(cm, "x")
+ @support.refcount_test
+ def test_refleaks_in_classmethod___init__(self):
+ gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
+ cm = classmethod(None)
+ refs_before = gettotalrefcount()
+ for i in range(100):
+ cm.__init__(None)
+ self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
+
@support.impl_detail("the module 'xxsubtype' is internal")
def test_classmethods_in_c(self):
# Testing C-based class methods...
@@ -1614,6 +1623,15 @@ order (MRO) for bases """
del sm.x
self.assertNotHasAttr(sm, "x")
+ @support.refcount_test
+ def test_refleaks_in_staticmethod___init__(self):
+ gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
+ sm = staticmethod(None)
+ refs_before = gettotalrefcount()
+ for i in range(100):
+ sm.__init__(None)
+ self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
+
@support.impl_detail("the module 'xxsubtype' is internal")
def test_staticmethods_in_c(self):
# Testing C-based static methods...