summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-08-22 07:44:24 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-08-22 07:44:24 (GMT)
commit9117c751488a98810d758f15b3113527beb920ef (patch)
treee75666f723e74149d9cb0fb0d9d4fd6b85678883 /Lib/_abcoll.py
parenta52bae7521dc97f37416cf7e03036a8467672833 (diff)
downloadcpython-9117c751488a98810d758f15b3113527beb920ef.zip
cpython-9117c751488a98810d758f15b3113527beb920ef.tar.gz
cpython-9117c751488a98810d758f15b3113527beb920ef.tar.bz2
Issue #9214: Fix set operations on KeysView and ItemsView.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 7890e97..d3e23c1 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -393,6 +393,10 @@ class MappingView(Sized):
class KeysView(MappingView, Set):
+ @classmethod
+ def _from_iterable(self, it):
+ return set(it)
+
def __contains__(self, key):
return key in self._mapping
@@ -405,6 +409,10 @@ KeysView.register(dict_keys)
class ItemsView(MappingView, Set):
+ @classmethod
+ def _from_iterable(self, it):
+ return set(it)
+
def __contains__(self, item):
key, value = item
try: