diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-05-05 10:06:17 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-05-05 10:06:17 (GMT) |
commit | de9725f1352856b7d6de1bb29383a7be5f181740 (patch) | |
tree | 3fff3245c5dff4684440f7e9227c34bed9ef27b5 /Objects/object.c | |
parent | 2cfe36828342e16cd274b968736a01aed5c49557 (diff) | |
download | cpython-de9725f1352856b7d6de1bb29383a7be5f181740.zip cpython-de9725f1352856b7d6de1bb29383a7be5f181740.tar.gz cpython-de9725f1352856b7d6de1bb29383a7be5f181740.tar.bz2 |
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__.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index 2c033f8..f952405 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -835,6 +835,7 @@ PyObject_RichCompare(PyObject *v, PyObject *w, int op) return res; } +/* Return -1 if error; 1 if v op w; 0 if not (v op w). */ int PyObject_RichCompareBool(PyObject *v, PyObject *w, int op) { |