@@ -196,11 +196,11 @@ gc_list_merge(PyGC_Head *from, PyGC_Head *to)
196196 gc_list_init (from );
197197}
198198
199- static long
199+ static Py_ssize_t
200200gc_list_size (PyGC_Head * list )
201201{
202202 PyGC_Head * gc ;
203- long n = 0 ;
203+ Py_ssize_t n = 0 ;
204204 for (gc = list -> gc .gc_next ; gc != list ; gc = gc -> gc .gc_next ) {
205205 n ++ ;
206206 }
@@ -719,12 +719,12 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old)
719719
720720/* This is the main function. Read this to understand how the
721721 * collection process works. */
722- static long
722+ static Py_ssize_t
723723collect (int generation )
724724{
725725 int i ;
726- long m = 0 ; /* # objects collected */
727- long n = 0 ; /* # unreachable objects that couldn't be collected */
726+ Py_ssize_t m = 0 ; /* # objects collected */
727+ Py_ssize_t n = 0 ; /* # unreachable objects that couldn't be collected */
728728 PyGC_Head * young ; /* the generation we are examining */
729729 PyGC_Head * old ; /* next older generation */
730730 PyGC_Head unreachable ; /* non-problematic unreachable trash */
@@ -856,11 +856,11 @@ collect(int generation)
856856 return n + m ;
857857}
858858
859- static long
859+ static Py_ssize_t
860860collect_generations (void )
861861{
862862 int i ;
863- long n = 0 ;
863+ Py_ssize_t n = 0 ;
864864
865865 /* Find the oldest generation (higest numbered) where the count
866866 * exceeds the threshold. Objects in the that generation and
@@ -919,7 +919,7 @@ PyDoc_STRVAR(gc_collect__doc__,
919919static PyObject *
920920gc_collect (PyObject * self , PyObject * noargs )
921921{
922- long n ;
922+ Py_ssize_t n ;
923923
924924 if (collecting )
925925 n = 0 ; /* already collecting, don't do anything */
@@ -929,7 +929,7 @@ gc_collect(PyObject *self, PyObject *noargs)
929929 collecting = 0 ;
930930 }
931931
932- return Py_BuildValue ( "l" , n );
932+ return PyInt_FromSsize_t ( n );
933933}
934934
935935PyDoc_STRVAR (gc_set_debug__doc__ ,
@@ -1181,10 +1181,10 @@ initgc(void)
11811181}
11821182
11831183/* API to invoke gc.collect() from C */
1184- long
1184+ Py_ssize_t
11851185PyGC_Collect (void )
11861186{
1187- long n ;
1187+ Py_ssize_t n ;
11881188
11891189 if (collecting )
11901190 n = 0 ; /* already collecting, don't do anything */
0 commit comments