summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-13 12:28:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-13 12:28:53 (GMT)
commit131b8f8eee3498d5d334bde9671825bdfe0cf222 (patch)
tree2b2ac519811dd9ee8f0029375eaf18642e91180c /Lib
parent6fce35354a7fecb9130fd163f86822c468d1413e (diff)
parent3d7497608ba8dd0b82d69944f484febdad7dc507 (diff)
downloadcpython-131b8f8eee3498d5d334bde9671825bdfe0cf222.zip
cpython-131b8f8eee3498d5d334bde9671825bdfe0cf222.tar.gz
cpython-131b8f8eee3498d5d334bde9671825bdfe0cf222.tar.bz2
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
NOTE: A direct call of super.__init__ is not endorsed!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_super.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
index dc3a15f..b84863f 100644
--- a/Lib/test/test_super.py
+++ b/Lib/test/test_super.py
@@ -171,6 +171,15 @@ class TestSuper(unittest.TestCase):
c = f().__closure__[0]
self.assertRaises(TypeError, X.meth, c)
+ def test_super_init_leaks(self):
+ # Issue #26718: super.__init__ leaked memory if called multiple times.
+ # This will be caught by regrtest.py -R if this leak.
+ # NOTE: Despite the use in the test a direct call of super.__init__
+ # is not endorsed.
+ sp = super(float, 1.0)
+ for i in range(1000):
+ super.__init__(sp, int, i)
+
if __name__ == "__main__":
unittest.main()