diff options
author | Raymond Hettinger <python@rcn.com> | 2010-11-29 03:56:12 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-11-29 03:56:12 (GMT) |
commit | ead22227cce112457b6beba8b008699ea4a3a084 (patch) | |
tree | 9dcc912a990ce6e6730f52e71d431ac489eb7b70 /Lib/_abcoll.py | |
parent | 263cbdfdfb0a7fe13f04c1b3188968d7a39d7d09 (diff) | |
download | cpython-ead22227cce112457b6beba8b008699ea4a3a084.zip cpython-ead22227cce112457b6beba8b008699ea4a3a084.tar.gz cpython-ead22227cce112457b6beba8b008699ea4a3a084.tar.bz2 |
Issue #10565: Iterator ABC should require both __next__ and __iter__.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r-- | Lib/_abcoll.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index cac06e0..0957553 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -90,7 +90,8 @@ class Iterator(Iterable): @classmethod def __subclasshook__(cls, C): if cls is Iterator: - if any("__next__" in B.__dict__ for B in C.__mro__): + if (any("__next__" in B.__dict__ for B in C.__mro__) and + any("__iter__" in B.__dict__ for B in C.__mro__)): return True return NotImplemented |