Message133015
functools_cmp_to_key() doesn't check that the argument is a callable.
>>> table=list(range(3))
>>> table.sort(key=functools.cmp_to_key(3))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
PyCallable_Check() should be used, something like:
if (!PyCallable_Check(cmp)) {
PyErr_SetString(PyExc_TypeError, "parameter must be callable");
return NULL;
} |
|
Date |
User |
Action |
Args |
2011-04-05 10:33:56 | vstinner | set | recipients:
+ vstinner, rhettinger, terry.reedy, ncoghlan, eric.smith, stutzbach, gruszczy, daniel.urban, python-dev |
2011-04-05 10:33:55 | vstinner | set | messageid: <1301999635.94.0.261193311165.issue11707@psf.upfronthosting.co.za> |
2011-04-05 10:33:55 | vstinner | link | issue11707 messages |
2011-04-05 10:33:55 | vstinner | create | |
|