aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-03-26 14:19:20 +0100
committerCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-03-26 14:19:20 +0100
commit17180924df69610769aba75239a3525198eef96b (patch)
treead7a2cec7ea377317eaad1983a85f166401468e8
parenta fast path for l[:] = l2 (diff)
downloadpypy-17180924df69610769aba75239a3525198eef96b.tar.gz
pypy-17180924df69610769aba75239a3525198eef96b.tar.bz2
pypy-17180924df69610769aba75239a3525198eef96b.zip
test and fix
-rw-r--r--pypy/objspace/std/listobject.py2
-rw-r--r--pypy/objspace/std/test/test_listobject.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
index 68096fe5a0..305455ac4d 100644
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -576,7 +576,7 @@ class W_ListObject(W_Root):
w_any.copy_into(self)
else:
# use the extend logic
- self.clear()
+ self.clear(space)
self.extend(w_any)
return
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
index 865162c9b8..cad64120c9 100644
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -1130,6 +1130,11 @@ class AppTestListObject(object):
b[i:i+1] = ['y']
assert b == ['y'] * count
+ def test_setslice_full_notlist(self):
+ l = [1, 2, 3]
+ l[::] = "abc"
+ assert l == ['a', 'b', 'c']
+
def test_recursive_repr(self):
l = []
assert repr(l) == '[]'