@@ -875,13 +875,11 @@ static PyMappingMethods dict_as_mapping = {
875875};
876876
877877static PyObject *
878- dict_keys (register dictobject * mp , PyObject * args )
878+ dict_keys (register dictobject * mp )
879879{
880880 register PyObject * v ;
881881 register int i , j , n ;
882882
883- if (!PyArg_NoArgs (args ))
884- return NULL ;
885883 again :
886884 n = mp -> ma_used ;
887885 v = PyList_New (n );
@@ -906,13 +904,11 @@ dict_keys(register dictobject *mp, PyObject *args)
906904}
907905
908906static PyObject *
909- dict_values (register dictobject * mp , PyObject * args )
907+ dict_values (register dictobject * mp )
910908{
911909 register PyObject * v ;
912910 register int i , j , n ;
913911
914- if (!PyArg_NoArgs (args ))
915- return NULL ;
916912 again :
917913 n = mp -> ma_used ;
918914 v = PyList_New (n );
@@ -937,14 +933,12 @@ dict_values(register dictobject *mp, PyObject *args)
937933}
938934
939935static PyObject *
940- dict_items (register dictobject * mp , PyObject * args )
936+ dict_items (register dictobject * mp )
941937{
942938 register PyObject * v ;
943939 register int i , j , n ;
944940 PyObject * item , * key , * value ;
945941
946- if (!PyArg_NoArgs (args ))
947- return NULL ;
948942 /* Preallocate the list of tuples, to avoid allocations during
949943 * the loop over the items, which could trigger GC, which
950944 * could resize the dict. :-(
@@ -987,12 +981,8 @@ dict_items(register dictobject *mp, PyObject *args)
987981}
988982
989983static PyObject *
990- dict_update (PyObject * mp , PyObject * args )
984+ dict_update (PyObject * mp , PyObject * other )
991985{
992- PyObject * other ;
993-
994- if (!PyArg_ParseTuple (args , "O:update" , & other ))
995- return NULL ;
996986 if (PyDict_Update (mp , other ) < 0 )
997987 return NULL ;
998988 Py_INCREF (Py_None );
@@ -1099,10 +1089,8 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
10991089}
11001090
11011091static PyObject *
1102- dict_copy (register dictobject * mp , PyObject * args )
1092+ dict_copy (register dictobject * mp )
11031093{
1104- if (!PyArg_Parse (args , "" ))
1105- return NULL ;
11061094 return PyDict_Copy ((PyObject * )mp );
11071095}
11081096
@@ -1155,7 +1143,7 @@ PyDict_Keys(PyObject *mp)
11551143 PyErr_BadInternalCall ();
11561144 return NULL ;
11571145 }
1158- return dict_keys ((dictobject * )mp , ( PyObject * ) NULL );
1146+ return dict_keys ((dictobject * )mp );
11591147}
11601148
11611149PyObject *
@@ -1165,7 +1153,7 @@ PyDict_Values(PyObject *mp)
11651153 PyErr_BadInternalCall ();
11661154 return NULL ;
11671155 }
1168- return dict_values ((dictobject * )mp , ( PyObject * ) NULL );
1156+ return dict_values ((dictobject * )mp );
11691157}
11701158
11711159PyObject *
@@ -1175,7 +1163,7 @@ PyDict_Items(PyObject *mp)
11751163 PyErr_BadInternalCall ();
11761164 return NULL ;
11771165 }
1178- return dict_items ((dictobject * )mp , ( PyObject * ) NULL );
1166+ return dict_items ((dictobject * )mp );
11791167}
11801168
11811169/* Subroutine which returns the smallest key in a for which b's value
@@ -1366,13 +1354,10 @@ dict_richcompare(PyObject *v, PyObject *w, int op)
13661354 }
13671355
13681356static PyObject *
1369- dict_has_key (register dictobject * mp , PyObject * args )
1357+ dict_has_key (register dictobject * mp , PyObject * key )
13701358{
1371- PyObject * key ;
13721359 long hash ;
13731360 register long ok ;
1374- if (!PyArg_ParseTuple (args , "O:has_key" , & key ))
1375- return NULL ;
13761361#ifdef CACHE_HASH
13771362 if (!PyString_Check (key ) ||
13781363 (hash = ((PyStringObject * ) key )-> ob_shash ) == -1 )
@@ -1447,24 +1432,20 @@ dict_setdefault(register dictobject *mp, PyObject *args)
14471432
14481433
14491434static PyObject *
1450- dict_clear (register dictobject * mp , PyObject * args )
1435+ dict_clear (register dictobject * mp )
14511436{
1452- if (!PyArg_NoArgs (args ))
1453- return NULL ;
14541437 PyDict_Clear ((PyObject * )mp );
14551438 Py_INCREF (Py_None );
14561439 return Py_None ;
14571440}
14581441
14591442static PyObject *
1460- dict_popitem (dictobject * mp , PyObject * args )
1443+ dict_popitem (dictobject * mp )
14611444{
14621445 int i = 0 ;
14631446 dictentry * ep ;
14641447 PyObject * res ;
14651448
1466- if (!PyArg_NoArgs (args ))
1467- return NULL ;
14681449 /* Allocate the result tuple before checking the size. Believe it
14691450 * or not, this allocation could trigger a garbage collection which
14701451 * could empty the dict, so if we checked the size first and that
@@ -1573,26 +1554,20 @@ select_item(PyObject *key, PyObject *value)
15731554}
15741555
15751556static PyObject *
1576- dict_iterkeys (dictobject * dict , PyObject * args )
1557+ dict_iterkeys (dictobject * dict )
15771558{
1578- if (!PyArg_ParseTuple (args , "" ))
1579- return NULL ;
15801559 return dictiter_new (dict , select_key );
15811560}
15821561
15831562static PyObject *
1584- dict_itervalues (dictobject * dict , PyObject * args )
1563+ dict_itervalues (dictobject * dict )
15851564{
1586- if (!PyArg_ParseTuple (args , "" ))
1587- return NULL ;
15881565 return dictiter_new (dict , select_value );
15891566}
15901567
15911568static PyObject *
1592- dict_iteritems (dictobject * dict , PyObject * args )
1569+ dict_iteritems (dictobject * dict )
15931570{
1594- if (!PyArg_ParseTuple (args , "" ))
1595- return NULL ;
15961571 return dictiter_new (dict , select_item );
15971572}
15981573
@@ -1638,31 +1613,31 @@ static char iteritems__doc__[] =
16381613"D.iteritems() -> an iterator over the (key, value) items of D" ;
16391614
16401615static PyMethodDef mapp_methods [] = {
1641- {"has_key" , (PyCFunction )dict_has_key , METH_VARARGS ,
1616+ {"has_key" , (PyCFunction )dict_has_key , METH_O ,
16421617 has_key__doc__ },
16431618 {"get" , (PyCFunction )dict_get , METH_VARARGS ,
16441619 get__doc__ },
16451620 {"setdefault" , (PyCFunction )dict_setdefault , METH_VARARGS ,
16461621 setdefault_doc__ },
1647- {"popitem" , (PyCFunction )dict_popitem , METH_OLDARGS ,
1622+ {"popitem" , (PyCFunction )dict_popitem , METH_NOARGS ,
16481623 popitem__doc__ },
1649- {"keys" , (PyCFunction )dict_keys , METH_OLDARGS ,
1624+ {"keys" , (PyCFunction )dict_keys , METH_NOARGS ,
16501625 keys__doc__ },
1651- {"items" , (PyCFunction )dict_items , METH_OLDARGS ,
1626+ {"items" , (PyCFunction )dict_items , METH_NOARGS ,
16521627 items__doc__ },
1653- {"values" , (PyCFunction )dict_values , METH_OLDARGS ,
1628+ {"values" , (PyCFunction )dict_values , METH_NOARGS ,
16541629 values__doc__ },
1655- {"update" , (PyCFunction )dict_update , METH_VARARGS ,
1630+ {"update" , (PyCFunction )dict_update , METH_O ,
16561631 update__doc__ },
1657- {"clear" , (PyCFunction )dict_clear , METH_OLDARGS ,
1632+ {"clear" , (PyCFunction )dict_clear , METH_NOARGS ,
16581633 clear__doc__ },
1659- {"copy" , (PyCFunction )dict_copy , METH_OLDARGS ,
1634+ {"copy" , (PyCFunction )dict_copy , METH_NOARGS ,
16601635 copy__doc__ },
1661- {"iterkeys" , (PyCFunction )dict_iterkeys , METH_VARARGS ,
1636+ {"iterkeys" , (PyCFunction )dict_iterkeys , METH_NOARGS ,
16621637 iterkeys__doc__ },
1663- {"itervalues" , (PyCFunction )dict_itervalues , METH_VARARGS ,
1638+ {"itervalues" , (PyCFunction )dict_itervalues , METH_NOARGS ,
16641639 itervalues__doc__ },
1665- {"iteritems" , (PyCFunction )dict_iteritems , METH_VARARGS ,
1640+ {"iteritems" , (PyCFunction )dict_iteritems , METH_NOARGS ,
16661641 iteritems__doc__ },
16671642 {NULL , NULL } /* sentinel */
16681643};
0 commit comments