Skip to content

Commit 8114c8d

Browse files
committed
test
1 parent cc94cb1 commit 8114c8d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/test/test_xml_etree_c.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# xml.etree test for cElementTree
22
import io
33
import struct
4+
import sys
45
from test import support
56
from test.support.import_helper import import_fresh_module
67
import types
@@ -171,6 +172,15 @@ def test_xmlpullparser_leaks(self):
171172
del parser
172173
support.gc_collect()
173174

175+
@support.refcount_test
176+
def test_xmlparser_refleaks_in___init__(self):
177+
gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
178+
parser = cET.XMLParser()
179+
refs_before = gettotalrefcount()
180+
for _ in range(100):
181+
parser.__init__()
182+
self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
183+
174184
def test_dict_disappearing_during_get_item(self):
175185
# test fix for seg fault reported in issue 27946
176186
class X:

0 commit comments

Comments
 (0)