@@ -1924,10 +1924,10 @@ is_typevar(PyObject *obj)
19241924}
19251925
19261926// Index of item in self[:len], or -1 if not found (self is a tuple)
1927- static int
1928- tuple_index (PyObject * self , int len , PyObject * item )
1927+ static Py_ssize_t
1928+ tuple_index (PyObject * self , Py_ssize_t len , PyObject * item )
19291929{
1930- for (int i = 0 ; i < len ; i ++ ) {
1930+ for (Py_ssize_t i = 0 ; i < len ; i ++ ) {
19311931 if (PyTuple_GET_ITEM (self , i ) == item ) {
19321932 return i ;
19331933 }
@@ -1939,28 +1939,28 @@ static PyObject *
19391939ga_getitem (PyObject * self , PyObject * item )
19401940{
19411941 gaobject * alias = (gaobject * )self ;
1942- int nparams = PyTuple_GET_SIZE (alias -> parameters );
1942+ Py_ssize_t nparams = PyTuple_GET_SIZE (alias -> parameters );
19431943 if (nparams == 0 ) {
19441944 return PyErr_Format (PyExc_TypeError ,
19451945 "There are no type variables left in %R" ,
19461946 self );
19471947 }
19481948 int is_tuple = PyTuple_Check (item );
1949- int nitem = is_tuple ? PyTuple_GET_SIZE (item ) : 1 ;
1949+ Py_ssize_t nitem = is_tuple ? PyTuple_GET_SIZE (item ) : 1 ;
19501950 if (nitem != nparams ) {
19511951 return PyErr_Format (PyExc_TypeError ,
19521952 "Too %s arguments for %R" ,
19531953 nitem > nparams ? "many" : "few" ,
19541954 self );
19551955 }
1956- int nargs = PyTuple_GET_SIZE (alias -> args );
1956+ Py_ssize_t nargs = PyTuple_GET_SIZE (alias -> args );
19571957 PyObject * newargs = PyTuple_New (nargs );
19581958 if (newargs == NULL )
19591959 return NULL ;
1960- for (int iarg = 0 ; iarg < nargs ; iarg ++ ) {
1960+ for (Py_ssize_t iarg = 0 ; iarg < nargs ; iarg ++ ) {
19611961 PyObject * arg = PyTuple_GET_ITEM (alias -> args , iarg );
19621962 if (is_typevar (arg )) {
1963- int iparam = tuple_index (alias -> parameters , nparams , arg );
1963+ Py_ssize_t iparam = tuple_index (alias -> parameters , nparams , arg );
19641964 assert (iparam >= 0 );
19651965 if (is_tuple ) {
19661966 arg = PyTuple_GET_ITEM (item , iparam );
@@ -2133,12 +2133,12 @@ PyTypeObject Py_GenericAliasType = {
21332133static PyObject *
21342134make_parameters (PyObject * args )
21352135{
2136- int len = PyTuple_GET_SIZE (args );
2136+ Py_ssize_t len = PyTuple_GET_SIZE (args );
21372137 PyObject * parameters = PyTuple_New (len );
21382138 if (parameters == NULL )
21392139 return NULL ;
2140- int iparam = 0 ;
2141- for (int iarg = 0 ; iarg < len ; iarg ++ ) {
2140+ Py_ssize_t iparam = 0 ;
2141+ for (Py_ssize_t iarg = 0 ; iarg < len ; iarg ++ ) {
21422142 PyObject * t = PyTuple_GET_ITEM (args , iarg );
21432143 if (is_typevar (t )) {
21442144 if (tuple_index (parameters , iparam , t ) < 0 ) {
0 commit comments