mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
Issue #9214: Fix set operations on KeysView and ItemsView.
This commit is contained in:
parent
058981b2ec
commit
917bba1f2a
2 changed files with 11 additions and 0 deletions
|
@ -390,6 +390,10 @@ class MappingView(Sized):
|
||||||
|
|
||||||
class KeysView(MappingView, Set):
|
class KeysView(MappingView, Set):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _from_iterable(self, it):
|
||||||
|
return set(it)
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
return key in self._mapping
|
return key in self._mapping
|
||||||
|
|
||||||
|
@ -400,6 +404,10 @@ class KeysView(MappingView, Set):
|
||||||
|
|
||||||
class ItemsView(MappingView, Set):
|
class ItemsView(MappingView, Set):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _from_iterable(self, it):
|
||||||
|
return set(it)
|
||||||
|
|
||||||
def __contains__(self, item):
|
def __contains__(self, item):
|
||||||
key, value = item
|
key, value = item
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -31,6 +31,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9214: Set operations on KeysView or ItemsView in the collections
|
||||||
|
module now correctly return a set. (Patch by Eli Bendersky.)
|
||||||
|
|
||||||
- Issue #9617: Signals received during a low-level write operation aren't
|
- Issue #9617: Signals received during a low-level write operation aren't
|
||||||
ignored by the buffered IO layer anymore.
|
ignored by the buffered IO layer anymore.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue