Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52fccfd

Browse files
committed
dict_has_key(): Accept only one parameter. PR#210 reported by
Andreas Jung <[email protected]>.
1 parent 0baf773 commit 52fccfd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Objects/dictobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ dict_has_key(mp, args)
959959
PyObject *key;
960960
long hash;
961961
register long ok;
962-
if (!PyArg_Parse(args, "O", &key))
962+
if (!PyArg_ParseTuple(args, "O:has_key", &key))
963963
return NULL;
964964
#ifdef CACHE_HASH
965965
if (!PyString_Check(key) ||
@@ -984,7 +984,7 @@ dict_get(mp, args)
984984
PyObject *val = NULL;
985985
long hash;
986986

987-
if (!PyArg_ParseTuple(args, "O|O", &key, &failobj))
987+
if (!PyArg_ParseTuple(args, "O|O:get", &key, &failobj))
988988
return NULL;
989989
if (mp->ma_table == NULL)
990990
goto finally;
@@ -1021,14 +1021,14 @@ dict_clear(mp, args)
10211021
}
10221022

10231023
static PyMethodDef mapp_methods[] = {
1024-
{"has_key", (PyCFunction)dict_has_key},
1024+
{"has_key", (PyCFunction)dict_has_key, METH_VARARGS},
10251025
{"keys", (PyCFunction)dict_keys},
10261026
{"items", (PyCFunction)dict_items},
10271027
{"values", (PyCFunction)dict_values},
10281028
{"update", (PyCFunction)dict_update},
10291029
{"clear", (PyCFunction)dict_clear},
10301030
{"copy", (PyCFunction)dict_copy},
1031-
{"get", (PyCFunction)dict_get, 1},
1031+
{"get", (PyCFunction)dict_get, METH_VARARGS},
10321032
{NULL, NULL} /* sentinel */
10331033
};
10341034

0 commit comments

Comments
 (0)