summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-10-08 21:08:29 (GMT)
committerGuido van Rossum <guido@python.org>2003-10-08 21:08:29 (GMT)
commit02c58f865c82021d1cde7064552d3a95301c8cc0 (patch)
tree1bfa52b4125e3634f1eb7a398bd9c97c2861dcdf /Objects
parent95a97d59c0317300bfdc0def004ee52e5fcfee66 (diff)
downloadcpython-02c58f865c82021d1cde7064552d3a95301c8cc0.zip
cpython-02c58f865c82021d1cde7064552d3a95301c8cc0.tar.gz
cpython-02c58f865c82021d1cde7064552d3a95301c8cc0.tar.bz2
SF patch #820195 by Wojtek Walczak (gminick at users.sourceforge.net):
make obj.__contains__() returns True/False instead of 1/0.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index af255f1..2708cdc 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3569,14 +3569,16 @@ wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped)
{
objobjproc func = (objobjproc)wrapped;
int res;
- PyObject *value;
+ PyObject *value, *ret;
if (!PyArg_ParseTuple(args, "O", &value))
return NULL;
res = (*func)(self, value);
if (res == -1 && PyErr_Occurred())
return NULL;
- return PyInt_FromLong((long)res);
+ ret = PyObject_IsTrue(PyInt_FromLong((long)res)) ? Py_True : Py_False;
+ Py_INCREF(ret);
+ return ret;
}
static PyObject *