mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813)
This commit is contained in:
parent
e6dac00779
commit
1b5f9c9653
3 changed files with 15 additions and 0 deletions
|
@ -1721,6 +1721,18 @@ class TestCollectionABCs(ABCTestCase):
|
|||
mss.clear()
|
||||
self.assertEqual(len(mss), 0)
|
||||
|
||||
# issue 34427
|
||||
# extending self should not cause infinite loop
|
||||
items = 'ABCD'
|
||||
mss2 = MutableSequenceSubclass()
|
||||
mss2.extend(items + items)
|
||||
mss.clear()
|
||||
mss.extend(items)
|
||||
mss.extend(mss)
|
||||
self.assertEqual(len(mss), len(mss2))
|
||||
self.assertEqual(list(mss), list(mss2))
|
||||
|
||||
|
||||
################################################################################
|
||||
### Counter
|
||||
################################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue