From: Mark Dickinson Date: Sun, 1 Aug 2010 11:10:28 +0000 (+0000) Subject: Add test for memory leak reported in issue 9422. X-Git-Tag: v3.2a2~567 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b1d35b9c74d726536afdd60cf629fba5bd66425;p=python Add test for memory leak reported in issue 9422. --- diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 6ca35ca31c..6ac8fdcc9c 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -560,7 +560,12 @@ class StructTest(unittest.TestCase): 'spam and eggs') self.assertRaises(struct.error, struct.unpack_from, '14s42', store, 0) - + def test_Struct_reinitialization(self): + # Issue 9422: there was a memory leak when reinitializing a + # Struct instance. This test can be used to detect the leak + # when running with regrtest -L. + s = struct.Struct('i') + s.__init__('ii') def test_main(): run_unittest(StructTest)