Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
NEEDS DOC CHANGES
A few more AttributeErrors turned into TypeErrors, but in test_contains
this time.
The full story for instance objects is pretty much unexplainable, because
instance_contains() tries its own flavor of iteration-based containment
testing first, and PySequence_Contains doesn't get a chance at it unless
instance_contains() blows up. A consequence is that
some_complex_number in some_instance
dies with a TypeError unless some_instance.__class__ defines __iter__ but
does not define __getitem__.
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
index 499d587..8fec425 100644
--- a/Lib/test/test_contains.py
+++ b/Lib/test/test_contains.py
@@ -31,13 +31,13 @@
try:
1 in a
check(0, "in base_set did not raise error")
-except AttributeError:
+except TypeError:
pass
try:
1 not in a
check(0, "not in base_set did not raise error")
-except AttributeError:
+except TypeError:
pass
# Test char in string