@@ -164,7 +164,7 @@ builtin_filter(PyObject *self, PyObject *args)
164164{
165165 PyObject * func , * seq , * result , * it ;
166166 int len ; /* guess for result list size */
167- register int i , j ;
167+ register int j ;
168168
169169 if (!PyArg_ParseTuple (args , "OO:filter" , & func , & seq ))
170170 return NULL ;
@@ -204,22 +204,15 @@ builtin_filter(PyObject *self, PyObject *args)
204204 }
205205
206206 /* Build the result list. */
207- for (i = j = 0 ; ; ++ i ) {
207+ j = 0 ;
208+ for (;;) {
208209 PyObject * item , * good ;
209210 int ok ;
210211
211212 item = PyIter_Next (it );
212213 if (item == NULL ) {
213- /* We're out of here in any case, but if this is a
214- * StopIteration exception it's expected, but if
215- * any other kind of exception it's an error.
216- */
217- if (PyErr_Occurred ()) {
218- if (PyErr_ExceptionMatches (PyExc_StopIteration ))
219- PyErr_Clear ();
220- else
221- goto Fail_result_it ;
222- }
214+ if (PyErr_Occurred ())
215+ goto Fail_result_it ;
223216 break ;
224217 }
225218
@@ -1030,24 +1023,14 @@ builtin_map(PyObject *self, PyObject *args)
10301023 if (item )
10311024 ++ numactive ;
10321025 else {
1033- /* StopIteration is *implied* by a
1034- * NULL return from PyIter_Next() if
1035- * PyErr_Occurred() is false.
1036- */
10371026 if (PyErr_Occurred ()) {
1038- if (PyErr_ExceptionMatches (
1039- PyExc_StopIteration ))
1040- PyErr_Clear ();
1041- else {
1042- Py_XDECREF (alist );
1043- goto Fail_1 ;
1044- }
1027+ Py_XDECREF (alist );
1028+ goto Fail_1 ;
10451029 }
10461030 Py_INCREF (Py_None );
10471031 item = Py_None ;
10481032 sqp -> saw_StopIteration = 1 ;
10491033 }
1050-
10511034 }
10521035 if (alist )
10531036 PyTuple_SET_ITEM (alist , j , item );
@@ -1445,7 +1428,6 @@ Return the dictionary containing the current scope's local variables.";
14451428static PyObject *
14461429min_max (PyObject * args , int op )
14471430{
1448- int i ;
14491431 PyObject * v , * w , * x , * it ;
14501432
14511433 if (PyTuple_Size (args ) > 1 )
@@ -1458,21 +1440,13 @@ min_max(PyObject *args, int op)
14581440 return NULL ;
14591441
14601442 w = NULL ; /* the result */
1461- for (i = 0 ; ; i ++ ) {
1443+ for (;; ) {
14621444 x = PyIter_Next (it );
14631445 if (x == NULL ) {
1464- /* We're out of here in any case, but if this is a
1465- * StopIteration exception it's expected, but if
1466- * any other kind of exception it's an error.
1467- */
14681446 if (PyErr_Occurred ()) {
1469- if (PyErr_ExceptionMatches (PyExc_StopIteration ))
1470- PyErr_Clear ();
1471- else {
1472- Py_XDECREF (w );
1473- Py_DECREF (it );
1474- return NULL ;
1475- }
1447+ Py_XDECREF (w );
1448+ Py_DECREF (it );
1449+ return NULL ;
14761450 }
14771451 break ;
14781452 }
@@ -1880,16 +1854,9 @@ builtin_reduce(PyObject *self, PyObject *args)
18801854
18811855 op2 = PyIter_Next (it );
18821856 if (op2 == NULL ) {
1883- /* StopIteration is *implied* by a NULL return from
1884- * PyIter_Next() if PyErr_Occurred() is false.
1885- */
1886- if (PyErr_Occurred ()) {
1887- if (PyErr_ExceptionMatches (PyExc_StopIteration ))
1888- PyErr_Clear ();
1889- else
1890- goto Fail ;
1891- }
1892- break ;
1857+ if (PyErr_Occurred ())
1858+ goto Fail ;
1859+ break ;
18931860 }
18941861
18951862 if (result == NULL )
0 commit comments