- } else if (PySequence_Check(x)) {
- t = x; x = 0;
- n = PySequence_Size(t); if (n < 0) goto end;
- if (n != 2 && n != 3)
- TYERR("want sequence of two or three items");
- if ((x = PySequence_GetItem(t, 0)) == 0 ||
- (y = PySequence_GetItem(t, 1)) == 0 ||
- (n == 3 && (z = PySequence_GetItem(t, 2)) == 0))
- goto end;
- rc = (n == 2) ? ecptxl_2(c, p, x, y) : ecptxl_3(c, p, x, y, z);
+ } else if ((t = PyObject_GetIter(x)) != 0) {
+ Py_DECREF(x);
+ x = PyIter_Next(t); if (!x) goto enditer;
+ y = PyIter_Next(t); if (!y) goto enditer;
+ z = PyIter_Next(t); if (!z && PyErr_Occurred()) goto end;
+ if (z) {
+ u = PyIter_Next(t);
+ if (u) goto enditer;
+ else if (PyErr_Occurred()) goto end;
+ }
+ rc = !z ? ecptxl_2(c, p, x, y) : ecptxl_3(c, p, x, y, z);