summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-10-19 07:09:25 (GMT)
committerLarry Hastings <larry@hastings.org>2013-10-19 07:09:25 (GMT)
commit3182680210fa0cf570233382bbaec8b64d57f4da (patch)
tree93932cf52fd5cbbdeab62b2fc43851e3cb637e3d /Objects/dictobject.c
parent5ceae41083f3bec479fe8f135f442e6576c6e273 (diff)
downloadcpython-3182680210fa0cf570233382bbaec8b64d57f4da.zip
cpython-3182680210fa0cf570233382bbaec8b64d57f4da.tar.gz
cpython-3182680210fa0cf570233382bbaec8b64d57f4da.tar.bz2
Issue #16612: Add "Argument Clinic", a compile-time preprocessor
for C files to generate argument parsing code. (See PEP 436.)
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index bbee1a6..2424176 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2160,9 +2160,31 @@ dict_richcompare(PyObject *v, PyObject *w, int op)
return res;
}
+/*[clinic]
+module dict
+
+@coexist
+dict.__contains__
+
+ key: object
+ /
+
+True if D has a key k, else False"
+[clinic]*/
+
+PyDoc_STRVAR(dict___contains____doc__,
+"True if D has a key k, else False\"\n"
+"\n"
+"dict.__contains__(key)");
+
+#define DICT___CONTAINS___METHODDEF \
+ {"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
+
static PyObject *
-dict_contains(PyDictObject *mp, PyObject *key)
+dict___contains__(PyObject *self, PyObject *key)
+/*[clinic checksum: 61c5c802ea1d35699a1a754f1f3538ea9b259cf4]*/
{
+ register PyDictObject *mp = (PyDictObject *)self;
Py_hash_t hash;
PyDictKeyEntry *ep;
PyObject **value_addr;
@@ -2447,9 +2469,6 @@ _PyDict_KeysSize(PyDictKeysObject *keys)
return sizeof(PyDictKeysObject) + (DK_SIZE(keys)-1) * sizeof(PyDictKeyEntry);
}
-PyDoc_STRVAR(contains__doc__,
-"D.__contains__(k) -> True if D has a key k, else False");
-
PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]");
PyDoc_STRVAR(sizeof__doc__,
@@ -2498,8 +2517,7 @@ PyDoc_STRVAR(values__doc__,
"D.values() -> an object providing a view on D's values");
static PyMethodDef mapp_methods[] = {
- {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST,
- contains__doc__},
+ DICT___CONTAINS___METHODDEF
{"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST,
getitem__doc__},
{"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,