Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 30662:6ef245136038 2.3
SF patch #820195: make object.__contains__() returns True or False instead
of 1 or 0.
Backport Guido's fix to the default __contains__() and to proxy_has_key()
so they will properly return booleans instead of integers.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Thu, 09 Oct 2003 20:51:07 +0000 |
| parents | dbde3dd31068 |
| children | 6c38406c3fad |
line wrap: on
line diff
--- a/Objects/typeobject.c Wed Oct 08 12:02:44 2003 +0000 +++ b/Objects/typeobject.c Thu Oct 09 20:51:07 2003 +0000 @@ -3562,7 +3562,8 @@ res = (*func)(self, value); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + else + return PyBool_FromLong(res); } static PyObject *
