(test, iter, cls, args=())
| 2078 | |
| 2079 | |
| 2080 | def check_free_after_iterating(test, iter, cls, args=()): |
| 2081 | done = False |
| 2082 | def wrapper(): |
| 2083 | class A(cls): |
| 2084 | def __del__(self): |
| 2085 | nonlocal done |
| 2086 | done = True |
| 2087 | try: |
| 2088 | next(it) |
| 2089 | except StopIteration: |
| 2090 | pass |
| 2091 | |
| 2092 | it = iter(A(*args)) |
| 2093 | # Issue 26494: Shouldn't crash |
| 2094 | test.assertRaises(StopIteration, next, it) |
| 2095 | |
| 2096 | wrapper() |
| 2097 | # The sequence should be deallocated just after the end of iterating |
| 2098 | gc_collect() |
| 2099 | test.assertTrue(done) |
| 2100 | |
| 2101 | |
| 2102 | def missing_compiler_executable(cmd_names=[]): |
searching dependent graphs…