mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
NOTE: A direct call of super.__init__ is not endorsed!
This commit is contained in:
parent
a3c532b0ed
commit
3d7497608b
3 changed files with 15 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue