File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import gc
21import re
32from array import array
43
@@ -184,29 +183,6 @@ def test_max_value_length(body_normalizer):
184183 assert len (result ["key" ]) == max_value_length
185184
186185
187- def test_serialize_does_not_leave_cyclic_garbage ():
188- # Applications running with the GC disabled rely on serialize() being
189- # freed by reference counting alone, so it must not create reference
190- # cycles.
191- gc_was_enabled = gc .isenabled ()
192- old_debug_flags = gc .get_debug ()
193- gc .collect ()
194- gc .disable ()
195- try :
196- serialize ({"extra" : {"foo" : [{"bar" : i } for i in range (20 )]}})
197- serialize ({"foo" : "bar" }, is_vars = True )
198-
199- gc .set_debug (gc .DEBUG_SAVEALL )
200- gc .collect ()
201- assert gc .garbage == []
202- finally :
203- gc .set_debug (old_debug_flags )
204- gc .garbage .clear ()
205- gc .collect ()
206- if gc_was_enabled :
207- gc .enable ()
208-
209-
210186def test_serialize_local_vars ():
211187 # This was added to make sure we don't try to iterate over instances of
212188 # custom classes with an __iter__ method due to potential side effects
You can’t perform that action at this time.
0 commit comments