#endif
/*[clinic input]
+module _collections
class _tuplegetter "_tuplegetterobject *" "&tuplegetter_type"
[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ee5ed5baabe35068]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=a8ece4ccad7e30ac]*/
static PyTypeObject tuplegetter_type;
#include "clinic/_collectionsmodule.c.h"
/* helper function for Counter *********************************************/
-PyDoc_STRVAR(_count_elements_doc,
-"_count_elements(mapping, iterable) -> None\n\
-\n\
-Count elements in the iterable, updating the mapping");
+/*[clinic input]
+_collections._count_elements
+
+ mapping: object
+ iterable: object
+ /
+
+Count elements in the iterable, updating the mapping
+[clinic start generated code]*/
static PyObject *
-_count_elements(PyObject *self, PyObject *args)
+_collections__count_elements_impl(PyObject *module, PyObject *mapping,
+ PyObject *iterable)
+/*[clinic end generated code: output=7e0c1789636b3d8f input=e79fad04534a0b45]*/
{
_Py_IDENTIFIER(get);
_Py_IDENTIFIER(__setitem__);
- PyObject *it, *iterable, *mapping, *oldval;
+ PyObject *it, *oldval;
PyObject *newval = NULL;
PyObject *key = NULL;
PyObject *bound_get = NULL;
PyObject *mapping_setitem;
PyObject *dict_setitem;
- if (!PyArg_UnpackTuple(args, "_count_elements", 2, 2, &mapping, &iterable))
- return NULL;
-
it = PyObject_GetIter(iterable);
if (it == NULL)
return NULL;
");
static struct PyMethodDef module_functions[] = {
- {"_count_elements", _count_elements, METH_VARARGS, _count_elements_doc},
+ _COLLECTIONS__COUNT_ELEMENTS_METHODDEF
{NULL, NULL} /* sentinel */
};
preserve
[clinic start generated code]*/
+PyDoc_STRVAR(_collections__count_elements__doc__,
+"_count_elements($module, mapping, iterable, /)\n"
+"--\n"
+"\n"
+"Count elements in the iterable, updating the mapping");
+
+#define _COLLECTIONS__COUNT_ELEMENTS_METHODDEF \
+ {"_count_elements", (PyCFunction)(void(*)(void))_collections__count_elements, METH_FASTCALL, _collections__count_elements__doc__},
+
+static PyObject *
+_collections__count_elements_impl(PyObject *module, PyObject *mapping,
+ PyObject *iterable);
+
+static PyObject *
+_collections__count_elements(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *mapping;
+ PyObject *iterable;
+
+ if (!_PyArg_CheckPositional("_count_elements", nargs, 2, 2)) {
+ goto exit;
+ }
+ mapping = args[0];
+ iterable = args[1];
+ return_value = _collections__count_elements_impl(module, mapping, iterable);
+
+exit:
+ return return_value;
+}
+
static PyObject *
tuplegetter_new_impl(PyTypeObject *type, Py_ssize_t index, PyObject *doc);
exit:
return return_value;
}
-/*[clinic end generated code: output=51bd572577ca7111 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9d2bfcc9df5faf35 input=a9049054013a1b77]*/