Userlist.copy() wasn't returning a UserList.
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 53e3dd7..4b447ac 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -887,7 +887,7 @@
def pop(self, i=-1): return self.data.pop(i)
def remove(self, item): self.data.remove(item)
def clear(self): self.data.clear()
- def copy(self): return self.data.copy()
+ def copy(self): return self.__class__(self)
def count(self, item): return self.data.count(item)
def index(self, item, *args): return self.data.index(item, *args)
def reverse(self): self.data.reverse()
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index 868ed24..6381070 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -52,6 +52,12 @@
return str(key) + '!!!'
self.assertEqual(next(iter(T((1,2)))), "0!!!")
+ def test_userlist_copy(self):
+ u = self.type2test([6, 8, 1, 9, 1])
+ v = u.copy()
+ self.assertEqual(u, v)
+ self.assertEqual(type(u), type(v))
+
def test_main():
support.run_unittest(UserListTest)