mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
This commit is contained in:
parent
13b3acd13e
commit
fbb1c5ee06
19 changed files with 94 additions and 24 deletions
|
@ -3,6 +3,7 @@
|
|||
import sys
|
||||
import unittest
|
||||
from test.support import run_unittest, TESTFN, unlink, cpython_only
|
||||
from test.support import check_free_after_iterating
|
||||
import pickle
|
||||
import collections.abc
|
||||
|
||||
|
@ -980,6 +981,9 @@ class TestCase(unittest.TestCase):
|
|||
self.assertEqual(next(it), 0)
|
||||
self.assertEqual(next(it), 1)
|
||||
|
||||
def test_free_after_iterating(self):
|
||||
check_free_after_iterating(self, iter, SequenceClass, (0,))
|
||||
|
||||
|
||||
def test_main():
|
||||
run_unittest(TestCase)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue