@@ -1924,10 +1924,10 @@ is_typevar(PyObject *obj)
1924
1924
}
1925
1925
1926
1926
// 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 )
1929
1929
{
1930
- for (int i = 0 ; i < len ; i ++ ) {
1930
+ for (Py_ssize_t i = 0 ; i < len ; i ++ ) {
1931
1931
if (PyTuple_GET_ITEM (self , i ) == item ) {
1932
1932
return i ;
1933
1933
}
@@ -1939,28 +1939,28 @@ static PyObject *
1939
1939
ga_getitem (PyObject * self , PyObject * item )
1940
1940
{
1941
1941
gaobject * alias = (gaobject * )self ;
1942
- int nparams = PyTuple_GET_SIZE (alias -> parameters );
1942
+ Py_ssize_t nparams = PyTuple_GET_SIZE (alias -> parameters );
1943
1943
if (nparams == 0 ) {
1944
1944
return PyErr_Format (PyExc_TypeError ,
1945
1945
"There are no type variables left in %R" ,
1946
1946
self );
1947
1947
}
1948
1948
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 ;
1950
1950
if (nitem != nparams ) {
1951
1951
return PyErr_Format (PyExc_TypeError ,
1952
1952
"Too %s arguments for %R" ,
1953
1953
nitem > nparams ? "many" : "few" ,
1954
1954
self );
1955
1955
}
1956
- int nargs = PyTuple_GET_SIZE (alias -> args );
1956
+ Py_ssize_t nargs = PyTuple_GET_SIZE (alias -> args );
1957
1957
PyObject * newargs = PyTuple_New (nargs );
1958
1958
if (newargs == NULL )
1959
1959
return NULL ;
1960
- for (int iarg = 0 ; iarg < nargs ; iarg ++ ) {
1960
+ for (Py_ssize_t iarg = 0 ; iarg < nargs ; iarg ++ ) {
1961
1961
PyObject * arg = PyTuple_GET_ITEM (alias -> args , iarg );
1962
1962
if (is_typevar (arg )) {
1963
- int iparam = tuple_index (alias -> parameters , nparams , arg );
1963
+ Py_ssize_t iparam = tuple_index (alias -> parameters , nparams , arg );
1964
1964
assert (iparam >= 0 );
1965
1965
if (is_tuple ) {
1966
1966
arg = PyTuple_GET_ITEM (item , iparam );
@@ -2133,12 +2133,12 @@ PyTypeObject Py_GenericAliasType = {
2133
2133
static PyObject *
2134
2134
make_parameters (PyObject * args )
2135
2135
{
2136
- int len = PyTuple_GET_SIZE (args );
2136
+ Py_ssize_t len = PyTuple_GET_SIZE (args );
2137
2137
PyObject * parameters = PyTuple_New (len );
2138
2138
if (parameters == NULL )
2139
2139
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 ++ ) {
2142
2142
PyObject * t = PyTuple_GET_ITEM (args , iarg );
2143
2143
if (is_typevar (t )) {
2144
2144
if (tuple_index (parameters , iparam , t ) < 0 ) {
0 commit comments