File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 22from test .test_json import PyTest , CTest
33import weakref
44import gc
5-
5+
66
77
88class JSONTestObject :
@@ -117,7 +117,7 @@ def default(self, o):
117117 with self .assertRaises (RecursionError ):
118118 with support .infinite_recursion (1000 ):
119119 EndlessJSONEncoder (check_circular = False ).encode (5j )
120-
120+
121121 @support .skip_if_unlimited_stack_size
122122 @support .skip_emscripten_stack_overflow ()
123123 @support .skip_wasi_stack_overflow ()
@@ -126,26 +126,26 @@ def test_memory_leak_on_recursion_error(self):
126126 weak_refs = []
127127 class LeakTestObj :
128128 pass
129-
129+
130130 def default (obj ):
131131 if isinstance (obj , LeakTestObj ):
132132 new_obj = LeakTestObj ()
133133 weak_refs .append (weakref .ref (new_obj ))
134134 return new_obj
135135 raise TypeError
136-
137-
136+
137+
138138 obj = LeakTestObj ()
139139 for _ in range (1000 ):
140140 obj = [obj ]
141-
141+
142142 with self .assertRaises (RecursionError ):
143143 self .dumps (obj , default = default )
144-
144+
145145 gc .collect ()
146146 for i , ref in enumerate (weak_refs ):
147147 self .assertIsNone (ref (),
148148 f"Object { i } still alive - memory leak detected!" )
149-
149+
150150class TestPyRecursion (TestRecursion , PyTest ): pass
151151class TestCRecursion (TestRecursion , CTest ): pass
You can’t perform that action at this time.
0 commit comments