bpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813)

This commit is contained in:
Naris R 2018-08-31 02:56:14 +10:00 committed by Raymond Hettinger
parent e6dac00779
commit 1b5f9c9653
3 changed files with 15 additions and 0 deletions

View file

@ -986,6 +986,8 @@ class MutableSequence(Sequence):
def extend(self, values):
'S.extend(iterable) -- extend sequence by appending elements from the iterable'
if values is self:
values = list(values)
for v in values:
self.append(v)