]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use proper API for iter.__next__().
authorGeorg Brandl <georg@python.org>
Sat, 24 Nov 2007 20:42:02 +0000 (20:42 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 24 Nov 2007 20:42:02 +0000 (20:42 +0000)
Objects/stringobject.c

index fd320f3d4441274e526d20badb398d8898e89383..7e3a84e6d254c872be8a3796dae5dc6d2dfd61aa 100644 (file)
@@ -2945,8 +2945,6 @@ string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        it = PyObject_GetIter(x);
        if (it == NULL)
                goto error;
-       // XXX(brett.cannon): No API for this?
-       iternext = *Py_Type(it)->tp_iternext;
 
        /* Run the iterator to exhaustion */
        for (i = 0; ; i++) {
@@ -2954,13 +2952,10 @@ string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
                Py_ssize_t value;
 
                /* Get the next item */
-               item = iternext(it);
+               item = PyIter_Next(it);
                if (item == NULL) {
-                       if (PyErr_Occurred()) {
-                           if (!PyErr_ExceptionMatches(PyExc_StopIteration))
-                                   goto error;
-                           PyErr_Clear();
-                       }
+                       if (PyErr_Occurred())
+                               goto error;
                        break;
                }