diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-01 20:34:00 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-01 20:34:00 +0300 |
commit | be81897da881725195bd353261ff8789cc1bba96 (patch) | |
tree | 3ceed7de8d98e8dd02bea2328fea512438360f55 /Python/bltinmodule.c | |
parent | 9d801b83fe62155003b33fca36c4c7278ad465da (diff) | |
parent | 654ed2fe070e1105e745eb286e847afb2841d080 (diff) | |
download | cpython-be81897da881725195bd353261ff8789cc1bba96.tar.gz |
Regenerate Argument Clinic code for issue #26874.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f3d0c9a870..0637a2ded9 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -331,7 +331,7 @@ builtin_any(PyModuleDef *module, PyObject *iterable) Py_DECREF(it); return NULL; } - if (cmp == 1) { + if (cmp > 0) { Py_DECREF(it); Py_RETURN_TRUE; } @@ -469,6 +469,7 @@ filter_next(filterobject *lz) PyObject *it = lz->it; long ok; PyObject *(*iternext)(PyObject *); + int checktrue = lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type; iternext = *Py_TYPE(it)->tp_iternext; for (;;) { @@ -476,12 +477,11 @@ filter_next(filterobject *lz) if (item == NULL) return NULL; - if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) { + if (checktrue) { ok = PyObject_IsTrue(item); } else { PyObject *good; - good = PyObject_CallFunctionObjArgs(lz->func, - item, NULL); + good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); if (good == NULL) { Py_DECREF(item); return NULL; @@ -1174,13 +1174,14 @@ map_next(mapobject *lz) PyObject *result; Py_ssize_t numargs, i; - numargs = PyTuple_Size(lz->iters); + numargs = PyTuple_GET_SIZE(lz->iters); argtuple = PyTuple_New(numargs); if (argtuple == NULL) return NULL; for (i=0 ; i<numargs ; i++) { - val = PyIter_Next(PyTuple_GET_ITEM(lz->iters, i)); + PyObject *it = PyTuple_GET_ITEM(lz->iters, i); + val = Py_TYPE(it)->tp_iternext(it); if (val == NULL) { Py_DECREF(argtuple); return NULL; @@ -1930,9 +1931,8 @@ builtin_input_impl(PyModuleDef *module, PyObject *prompt) Py_CLEAR(stringpo); if (po == NULL) goto _readline_errors; - promptstr = PyBytes_AsString(po); - if (promptstr == NULL) - goto _readline_errors; + assert(PyBytes_Check(po)); + promptstr = PyBytes_AS_STRING(po); } else { po = NULL; |