Mercurial > cpython-lru_cache-weakref
diff Objects/setobject.c @ 42756:0b62539acfb8
Patch by Keir Mierle so that sets can be compared to other objects that know
how to compare themselves to sets. (Prep work for making dict views more
set-like.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 23 Aug 2007 23:57:24 +0000 |
| parents | ce52cd71a8d9 |
| children | 0ff41b163f5b |
line wrap: on
line diff
--- a/Objects/setobject.c Thu Aug 23 23:35:15 2007 +0000 +++ b/Objects/setobject.c Thu Aug 23 23:57:24 2007 +0000 @@ -1607,12 +1607,8 @@ PyObject *r1, *r2; if(!PyAnySet_Check(w)) { - if (op == Py_EQ) - Py_RETURN_FALSE; - if (op == Py_NE) - Py_RETURN_TRUE; - PyErr_SetString(PyExc_TypeError, "can only compare to a set"); - return NULL; + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; } switch (op) { case Py_EQ:
