mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
SF patch #820195 by Wojtek Walczak (gminick at users.sourceforge.net):
make obj.__contains__() returns True/False instead of 1/0.
This commit is contained in:
parent
95a97d59c0
commit
02c58f865c
3 changed files with 8 additions and 2 deletions
|
@ -572,6 +572,7 @@ Frank Visser
|
||||||
Charles Waldman
|
Charles Waldman
|
||||||
Richard Walker
|
Richard Walker
|
||||||
Larry Wall
|
Larry Wall
|
||||||
|
Wojtek Walczak
|
||||||
Greg Ward
|
Greg Ward
|
||||||
Barry Warsaw
|
Barry Warsaw
|
||||||
Steve Waterbury
|
Steve Waterbury
|
||||||
|
|
|
@ -30,6 +30,9 @@ Core and builtins
|
||||||
- zip() with no arguments now returns an empty list instead of raising
|
- zip() with no arguments now returns an empty list instead of raising
|
||||||
a TypeError exception.
|
a TypeError exception.
|
||||||
|
|
||||||
|
- obj.__contains__() now returns True/False instead of 1/0. SF patch
|
||||||
|
820195.
|
||||||
|
|
||||||
Extension modules
|
Extension modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
@ -3569,14 +3569,16 @@ wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped)
|
||||||
{
|
{
|
||||||
objobjproc func = (objobjproc)wrapped;
|
objobjproc func = (objobjproc)wrapped;
|
||||||
int res;
|
int res;
|
||||||
PyObject *value;
|
PyObject *value, *ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O", &value))
|
if (!PyArg_ParseTuple(args, "O", &value))
|
||||||
return NULL;
|
return NULL;
|
||||||
res = (*func)(self, value);
|
res = (*func)(self, value);
|
||||||
if (res == -1 && PyErr_Occurred())
|
if (res == -1 && PyErr_Occurred())
|
||||||
return NULL;
|
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 *
|
static PyObject *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue