homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JBernardo
Recipients JBernardo, benjamin.peterson, georg.brandl, pitrou
Date 2011年12月28日.17:22:54
SpamBayes Score 7.065093e-11
Marked as misclassified No
Message-id <1325092975.45.0.968032663993.issue13667@psf.upfronthosting.co.za>
In-reply-to
Content
Using my poor grep abilities I found that on Objects/typeobject.c
(I replaced some declarations/error checking from the code with ...)
static int
slot_sq_contains(PyObject *self, PyObject *value) {
 ...
 func = lookup_maybe(self, "__contains__", &contains_str);
 if (func != NULL) {
 ...
 res = PyObject_Call(func, args, NULL);
 ...
 if (res != NULL) {
 result = PyObject_IsTrue(res);
 Py_DECREF(res);
 }
 }
 else if (! PyErr_Occurred()) {
 /* Possible results: -1 and 1 */
 result = (int)_PySequence_IterSearch(self, value,
 PY_ITERSEARCH_CONTAINS);
 }
}
 
I don't know if I'm in the right place, but the function returns `int` and evaluates the result to 1 or 0 if __contains__ is found.
I also don't know what SQSLOT means, but unlike the other operators (which are defined as TPSLOT), `slot_sq_contains` is a function returning "int" while `slot_tp_richcompare` returns "PyObject *".
Why is that defined that way?
History
Date User Action Args
2011年12月28日 17:22:55JBernardosetrecipients: + JBernardo, georg.brandl, pitrou, benjamin.peterson
2011年12月28日 17:22:55JBernardosetmessageid: <1325092975.45.0.968032663993.issue13667@psf.upfronthosting.co.za>
2011年12月28日 17:22:54JBernardolinkissue13667 messages
2011年12月28日 17:22:54JBernardocreate

AltStyle によって変換されたページ (->オリジナル) /