summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-08-01 11:10:28 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-08-01 11:10:28 (GMT)
commit5b1d35b9c74d726536afdd60cf629fba5bd66425 (patch)
tree6c93c57c3753d0e8ab222f65b00624c81be3e0ed /Lib
parent5b65df7ce200fd4320fe5db1a307ee438de7a5ee (diff)
downloadcpython-5b1d35b9c74d726536afdd60cf629fba5bd66425.zip
cpython-5b1d35b9c74d726536afdd60cf629fba5bd66425.tar.gz
cpython-5b1d35b9c74d726536afdd60cf629fba5bd66425.tar.bz2
Add test for memory leak reported in issue 9422.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_struct.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 6ca35ca..6ac8fdc 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)