[Python-checkins] cpython: Remove dead code (unreachable)

raymond.hettinger python-checkins at python.org
Sun Aug 16 00:09:36 CEST 2015


https://hg.python.org/cpython/rev/d67e2b7314b5
changeset:   97395:d67e2b7314b5
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Aug 15 15:09:30 2015 -0700
summary:
  Remove dead code (unreachable)

files:
  Modules/itertoolsmodule.c |  7 ++-----
  1 files changed, 2 insertions(+), 5 deletions(-)


diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -940,12 +940,9 @@
             }
             return item;
         }
-        if (PyErr_Occurred()) {
-            if (PyErr_ExceptionMatches(PyExc_StopIteration))
-                PyErr_Clear();
-            else
+        /* Note:  StopIteration is already cleared by PyIter_Next() */
+        if (PyErr_Occurred())
                 return NULL;
-        }
         if (PyList_Size(lz->saved) == 0)
             return NULL;
         it = PyObject_GetIter(lz->saved);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list