@@ -633,7 +633,7 @@ collect(int generation)
633633
634634 /* Collect statistics on uncollectable objects found and print
635635 * debugging information. */
636- for (gc = finalizers .gc .gc_next ;
636+ for (gc = finalizers .gc .gc_next ;
637637 gc != & finalizers ;
638638 gc = gc -> gc .gc_next ) {
639639 n ++ ;
@@ -699,14 +699,9 @@ PyDoc_STRVAR(gc_enable__doc__,
699699"Enable automatic garbage collection.\n" );
700700
701701static PyObject *
702- gc_enable (PyObject * self , PyObject * args )
702+ gc_enable (PyObject * self , PyObject * noargs )
703703{
704-
705- if (!PyArg_ParseTuple (args , ":enable" )) /* check no args */
706- return NULL ;
707-
708704 enabled = 1 ;
709-
710705 Py_INCREF (Py_None );
711706 return Py_None ;
712707}
@@ -717,14 +712,9 @@ PyDoc_STRVAR(gc_disable__doc__,
717712"Disable automatic garbage collection.\n" );
718713
719714static PyObject *
720- gc_disable (PyObject * self , PyObject * args )
715+ gc_disable (PyObject * self , PyObject * noargs )
721716{
722-
723- if (!PyArg_ParseTuple (args , ":disable" )) /* check no args */
724- return NULL ;
725-
726717 enabled = 0 ;
727-
728718 Py_INCREF (Py_None );
729719 return Py_None ;
730720}
@@ -735,12 +725,8 @@ PyDoc_STRVAR(gc_isenabled__doc__,
735725"Returns true if automatic garbage collection is enabled.\n" );
736726
737727static PyObject *
738- gc_isenabled (PyObject * self , PyObject * args )
728+ gc_isenabled (PyObject * self , PyObject * noargs )
739729{
740-
741- if (!PyArg_ParseTuple (args , ":isenabled" )) /* check no args */
742- return NULL ;
743-
744730 return Py_BuildValue ("i" , enabled );
745731}
746732
@@ -750,16 +736,12 @@ PyDoc_STRVAR(gc_collect__doc__,
750736"Run a full collection. The number of unreachable objects is returned.\n" );
751737
752738static PyObject *
753- gc_collect (PyObject * self , PyObject * args )
739+ gc_collect (PyObject * self , PyObject * noargs )
754740{
755741 long n ;
756742
757- if (!PyArg_ParseTuple (args , ":collect" )) /* check no args */
758- return NULL ;
759-
760- if (collecting ) {
743+ if (collecting )
761744 n = 0 ; /* already collecting, don't do anything */
762- }
763745 else {
764746 collecting = 1 ;
765747 n = collect (NUM_GENERATIONS - 1 );
@@ -801,11 +783,8 @@ PyDoc_STRVAR(gc_get_debug__doc__,
801783"Get the garbage collection debugging flags.\n" );
802784
803785static PyObject *
804- gc_get_debug (PyObject * self , PyObject * args )
786+ gc_get_debug (PyObject * self , PyObject * noargs )
805787{
806- if (!PyArg_ParseTuple (args , ":get_debug" )) /* no args */
807- return NULL ;
808-
809788 return Py_BuildValue ("i" , debug );
810789}
811790
@@ -839,11 +818,8 @@ PyDoc_STRVAR(gc_get_thresh__doc__,
839818"Return the current collection thresholds\n" );
840819
841820static PyObject *
842- gc_get_thresh (PyObject * self , PyObject * args )
821+ gc_get_thresh (PyObject * self , PyObject * noargs )
843822{
844- if (!PyArg_ParseTuple (args , ":get_threshold" )) /* no args */
845- return NULL ;
846-
847823 return Py_BuildValue ("(iii)" ,
848824 generations [0 ].threshold ,
849825 generations [1 ].threshold ,
@@ -948,17 +924,14 @@ append_objects(PyObject *py_list, PyGC_Head *gc_list)
948924}
949925
950926static PyObject *
951- gc_get_objects (PyObject * self , PyObject * args )
927+ gc_get_objects (PyObject * self , PyObject * noargs )
952928{
953929 int i ;
954930 PyObject * result ;
955931
956- if (!PyArg_ParseTuple (args , ":get_objects" )) /* check no args */
957- return NULL ;
958932 result = PyList_New (0 );
959- if (result == NULL ) {
933+ if (result == NULL )
960934 return NULL ;
961- }
962935 for (i = 0 ; i < NUM_GENERATIONS ; i ++ ) {
963936 if (append_objects (result , GEN_HEAD (i ))) {
964937 Py_DECREF (result );
@@ -985,15 +958,15 @@ PyDoc_STRVAR(gc__doc__,
985958"get_referrents() -- Return the list of objects that an object refers to.\n" );
986959
987960static PyMethodDef GcMethods [] = {
988- {"enable" , gc_enable , METH_VARARGS , gc_enable__doc__ },
989- {"disable" , gc_disable , METH_VARARGS , gc_disable__doc__ },
990- {"isenabled" , gc_isenabled , METH_VARARGS , gc_isenabled__doc__ },
961+ {"enable" , gc_enable , METH_NOARGS , gc_enable__doc__ },
962+ {"disable" , gc_disable , METH_NOARGS , gc_disable__doc__ },
963+ {"isenabled" , gc_isenabled , METH_NOARGS , gc_isenabled__doc__ },
991964 {"set_debug" , gc_set_debug , METH_VARARGS , gc_set_debug__doc__ },
992- {"get_debug" , gc_get_debug , METH_VARARGS , gc_get_debug__doc__ },
965+ {"get_debug" , gc_get_debug , METH_NOARGS , gc_get_debug__doc__ },
993966 {"set_threshold" , gc_set_thresh , METH_VARARGS , gc_set_thresh__doc__ },
994- {"get_threshold" , gc_get_thresh , METH_VARARGS , gc_get_thresh__doc__ },
995- {"collect" , gc_collect , METH_VARARGS , gc_collect__doc__ },
996- {"get_objects" , gc_get_objects ,METH_VARARGS , gc_get_objects__doc__ },
967+ {"get_threshold" , gc_get_thresh , METH_NOARGS , gc_get_thresh__doc__ },
968+ {"collect" , gc_collect , METH_NOARGS , gc_collect__doc__ },
969+ {"get_objects" , gc_get_objects ,METH_NOARGS , gc_get_objects__doc__ },
997970 {"get_referrers" , gc_get_referrers , METH_VARARGS ,
998971 gc_get_referrers__doc__ },
999972 {"get_referrents" , gc_get_referrents , METH_VARARGS ,
0 commit comments