MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_gc

Method test_gc

Lib/test/test_faulthandler.py:203–236  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

201
202 @skip_segfault_on_android
203 def test_gc(self):
204 # bpo-44466: Detect if the GC is running
205 self.check_fatal_error("""
206 import faulthandler
207 import gc
208 import sys
209
210 faulthandler.enable()
211
212 class RefCycle:
213 def __del__(self):
214 faulthandler._sigsegv()
215
216 # create a reference cycle which triggers a fatal
217 # error in a destructor
218 a = RefCycle()
219 b = RefCycle()
220 a.b = b
221 b.a = a
222
223 # Delete the objects, not the cycle
224 a = None
225 b = None
226
227 # Break the reference cycle: call __del__()
228 gc.collect()
229
230 # Should not reach this line
231 print("exit", file=sys.stderr)
232 """,
233 9,
234 'Segmentation fault',
235 function='__del__',
236 garbage_collecting=True)
237
238 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 0 == 0
239 def test_fatal_error_c_thread(self):

Callers

nothing calls this directly

Calls 1

check_fatal_errorMethod · 0.95

Tested by

no test coverage detected