blob: d0cdfc3edafef261afec17af8e1c8cdf93779624 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(dict_fromkeys__doc__,
6"fromkeys($type, iterable, value=None, /)\n"
7"--\n"
8"\n"
9"Returns a new dict with keys from iterable and values equal to value.");
10
11#define DICT_FROMKEYS_METHODDEF \
12 {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
13
14static PyObject *
15dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
16
17static PyObject *
18dict_fromkeys(PyTypeObject *type, PyObject *args)
19{
20 PyObject *return_value = NULL;
21 PyObject *iterable;
22 PyObject *value = Py_None;
23
24 if (!PyArg_UnpackTuple(args, "fromkeys",
25 1, 2,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030026 &iterable, &value)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030027 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030028 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030029 return_value = dict_fromkeys_impl(type, iterable, value);
30
31exit:
32 return return_value;
33}
34
35PyDoc_STRVAR(dict___contains____doc__,
36"__contains__($self, key, /)\n"
37"--\n"
38"\n"
39"True if D has a key k, else False.");
40
41#define DICT___CONTAINS___METHODDEF \
42 {"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030043/*[clinic end generated code: output=926326109e3d9839 input=a9049054013a1b77]*/