summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-11-24 20:42:02 (GMT)
committerGeorg Brandl <georg@python.org>2007-11-24 20:42:02 (GMT)
commit5fb8eb9e410821d6b7919445765cd4849f1fb5cc (patch)
tree6c10d0af237592c60b87cbc105e14c9179c2358d
parentb078925154f6ba5a6feeaf4e64c5f0caa9c7d717 (diff)
downloadcpython-5fb8eb9e410821d6b7919445765cd4849f1fb5cc.zip
cpython-5fb8eb9e410821d6b7919445765cd4849f1fb5cc.tar.gz
cpython-5fb8eb9e410821d6b7919445765cd4849f1fb5cc.tar.bz2
Use proper API for iter.__next__().
-rw-r--r--Objects/stringobject.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index fd320f3..7e3a84e 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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;
}