@@ -193,8 +193,8 @@ static PyObject *
193193builtin_filter (PyObject * self , PyObject * args )
194194{
195195 PyObject * func , * seq , * result , * it , * arg ;
196- int len ; /* guess for result list size */
197- register int j ;
196+ Py_ssize_t len ; /* guess for result list size */
197+ register Py_ssize_t j ;
198198
199199 if (!PyArg_UnpackTuple (args , "filter" , 2 , 2 , & func , & seq ))
200200 return NULL ;
@@ -860,7 +860,7 @@ builtin_map(PyObject *self, PyObject *args)
860860 len = 0 ;
861861 for (i = 0 , sqp = seqs ; i < n ; ++ i , ++ sqp ) {
862862 PyObject * curseq ;
863- int curlen ;
863+ Py_ssize_t curlen ;
864864
865865 /* Get iterator. */
866866 curseq = PyTuple_GetItem (args , i + 1 );
@@ -1338,7 +1338,7 @@ static PyObject *
13381338builtin_ord (PyObject * self , PyObject * obj )
13391339{
13401340 long ord ;
1341- int size ;
1341+ Py_ssize_t size ;
13421342
13431343 if (PyString_Check (obj )) {
13441344 size = PyString_GET_SIZE (obj );
@@ -1363,7 +1363,7 @@ builtin_ord(PyObject *self, PyObject* obj)
13631363
13641364 PyErr_Format (PyExc_TypeError ,
13651365 "ord() expected a character, "
1366- "but string of length %d found" ,
1366+ "but string of length %zd found" ,
13671367 size );
13681368 return NULL ;
13691369}
@@ -2094,10 +2094,10 @@ static PyObject*
20942094builtin_zip (PyObject * self , PyObject * args )
20952095{
20962096 PyObject * ret ;
2097- const int itemsize = PySequence_Length (args );
2098- int i ;
2097+ const Py_ssize_t itemsize = PySequence_Length (args );
2098+ Py_ssize_t i ;
20992099 PyObject * itlist ; /* tuple of iterators */
2100- int len ; /* guess at result length */
2100+ Py_ssize_t len ; /* guess at result length */
21012101
21022102 if (itemsize == 0 )
21032103 return PyList_New (0 );
@@ -2111,7 +2111,7 @@ builtin_zip(PyObject *self, PyObject *args)
21112111 len = -1 ; /* unknown */
21122112 for (i = 0 ; i < itemsize ; ++ i ) {
21132113 PyObject * item = PyTuple_GET_ITEM (args , i );
2114- int thislen = _PyObject_LengthHint (item );
2114+ Py_ssize_t thislen = _PyObject_LengthHint (item );
21152115 if (thislen < 0 ) {
21162116 if (!PyErr_ExceptionMatches (PyExc_TypeError ) &&
21172117 !PyErr_ExceptionMatches (PyExc_AttributeError )) {
@@ -2460,7 +2460,7 @@ filterstring(PyObject *func, PyObject *strobj)
24602460 Py_DECREF (good );
24612461 }
24622462 if (ok ) {
2463- int reslen ;
2463+ Py_ssize_t reslen ;
24642464 if (!PyString_Check (item )) {
24652465 PyErr_SetString (PyExc_TypeError , "can't filter str to str:"
24662466 " __getitem__ returned different type" );
@@ -2473,7 +2473,7 @@ filterstring(PyObject *func, PyObject *strobj)
24732473 PyString_AS_STRING (item )[0 ];
24742474 } else {
24752475 /* do we need more space? */
2476- int need = j + reslen + len - i - 1 ;
2476+ Py_ssize_t need = j + reslen + len - i - 1 ;
24772477 if (need > outlen ) {
24782478 /* overallocate, to avoid reallocations */
24792479 if (need < 2 * outlen )
@@ -2513,8 +2513,8 @@ filterunicode(PyObject *func, PyObject *strobj)
25132513{
25142514 PyObject * result ;
25152515 register int i , j ;
2516- int len = PyUnicode_GetSize (strobj );
2517- int outlen = len ;
2516+ Py_ssize_t len = PyUnicode_GetSize (strobj );
2517+ Py_ssize_t outlen = len ;
25182518
25192519 if (func == Py_None ) {
25202520 /* If it's a real string we can return the original,
@@ -2554,7 +2554,7 @@ filterunicode(PyObject *func, PyObject *strobj)
25542554 Py_DECREF (good );
25552555 }
25562556 if (ok ) {
2557- int reslen ;
2557+ Py_ssize_t reslen ;
25582558 if (!PyUnicode_Check (item )) {
25592559 PyErr_SetString (PyExc_TypeError ,
25602560 "can't filter unicode to unicode:"
@@ -2568,7 +2568,7 @@ filterunicode(PyObject *func, PyObject *strobj)
25682568 PyUnicode_AS_UNICODE (item )[0 ];
25692569 else {
25702570 /* do we need more space? */
2571- int need = j + reslen + len - i - 1 ;
2571+ Py_ssize_t need = j + reslen + len - i - 1 ;
25722572 if (need > outlen ) {
25732573 /* overallocate,
25742574 to avoid reallocations */
0 commit comments