Function
check_free_after_iterating
(test, iter, cls, args=())
Source from the content-addressed store, hash-verified
| 2004 | |
| 2005 | |
| 2006 | def 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 | |
| 2032 | def missing_compiler_executable(cmd_names=[]): |