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.
*Release date: XXX *
+Core and builtins
+-----------------
+
+- Patch #820195: object.__contains__() now returns True or False instead
+ of 1 or 0.
+
Extension modules
-----------------
static PyObject *
proxy_has_key(proxyobject *pp, PyObject *key)
{
- return PyInt_FromLong(PySequence_Contains(pp->dict, key));
+ int res = PySequence_Contains(pp->dict, key);
+ if (res < 0)
+ return NULL;
+ return PyBool_FromLong(res);
}
static PyObject *
res = (*func)(self, value);
if (res == -1 && PyErr_Occurred())
return NULL;
- return PyInt_FromLong((long)res);
+ else
+ return PyBool_FromLong(res);
}
static PyObject *