summaryrefslogtreecommitdiffstats
path: root/Lib/_collections_abc.py
diff options
context:
space:
mode:
authorNaris R <nariscatboy@gmail.com>2018-08-30 16:56:14 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2018-08-30 16:56:14 (GMT)
commit1b5f9c9653f348b0aa8b7ca39f8a9361150f7dfc (patch)
treedca9f2435a0fdd8a30e1d3ecc1a3d2e3499379da /Lib/_collections_abc.py
parente6dac0077996b1e1f886f036d6f2606237fa4c85 (diff)
downloadcpython-1b5f9c9653f348b0aa8b7ca39f8a9361150f7dfc.zip
cpython-1b5f9c9653f348b0aa8b7ca39f8a9361150f7dfc.tar.gz
cpython-1b5f9c9653f348b0aa8b7ca39f8a9361150f7dfc.tar.bz2
bpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813)
Diffstat (limited to 'Lib/_collections_abc.py')
-rw-r--r--Lib/_collections_abc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py
index dbe30df..c363987 100644
--- a/Lib/_collections_abc.py
+++ b/Lib/_collections_abc.py
@@ -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)