On Sun, Apr 19, 2015 at 2:09 AM, Paul Moore <p.f.moore@gmail.com> wrote:
So I'm not clear what "small change" you're referring to here:
* A change to CPython to reduce the number of false positives by making this case return False? If that, then no, I don't think a PEP is needed. But note that user code still can't assume that the above behaviour couldn't still happen in *other* cases, so the change would be of limited value (and whether it gets accepted depends on whether the complexity is justified by the benefit). * A change to the definition of callable() to remove the possibility of false positives at all? In that case, yes, a PEP probably *is* needed, as that's going to affect an awful lot of corner cases, and will impact all implementations. It's probably not correct to call this a "small change". * Something else?
The discussion was about this small change: int PyCallable_Check(PyObject *x) { - if (x == NULL) + if (x == NULL) { return 0; - return x->ob_type->tp_call != NULL; + } + + return Py_TYPE(x)->tp_call && _PyObject_HasAttrId(x, &PyId___call__); } There are more explanations in the thread in case you want to know more. Thanks, -- Ionel Cristian Mărieș, http://blog.ionelmc.ro