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

Function check_free_after_iterating

Lib/test/support/__init__.py:2006–2029  ·  view source on GitHub ↗
(test, iter, cls, args=())

Source from the content-addressed store, hash-verified

2004
2005
2006def check_free_after_iterating(test, iter, cls, args=()):
2007 # TODO: RUSTPYTHON; GC is not supported yet
2008 test.assertTrue(False)
2009 return
2010
2011 done = False
2012 def wrapper():
2013 class A(cls):
2014 def __del__(self):
2015 nonlocal done
2016 done = True
2017 try:
2018 next(it)
2019 except StopIteration:
2020 pass
2021
2022 it = iter(A(*args))
2023 # Issue 26494: Shouldn't crash
2024 test.assertRaises(StopIteration, next, it)
2025
2026 wrapper()
2027 # The sequence should be deallocated just after the end of iterating
2028 gc_collect()
2029 test.assertTrue(done)
2030
2031
2032def missing_compiler_executable(cmd_names=[]):

Callers 1

Calls 3

gc_collectFunction · 0.85
assertTrueMethod · 0.80
wrapperFunction · 0.70

Tested by 1