MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / PyIter_NextItem

Function PyIter_NextItem

asyncpg/protocol/record/pythoncapi_compat.h:1634–1660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1632
1633#if PY_VERSION_HEX < 0x030E00A0
1634static inline int PyIter_NextItem(PyObject *iter, PyObject **item)
1635{
1636 iternextfunc tp_iternext;
1637
1638 assert(iter != NULL);
1639 assert(item != NULL);
1640
1641 tp_iternext = Py_TYPE(iter)->tp_iternext;
1642 if (tp_iternext == NULL) {
1643 *item = NULL;
1644 PyErr_Format(PyExc_TypeError, "expected an iterator, got '%s'",
1645 Py_TYPE(iter)->tp_name);
1646 return -1;
1647 }
1648
1649 if ((*item = tp_iternext(iter))) {
1650 return 1;
1651 }
1652 if (!PyErr_Occurred()) {
1653 return 0;
1654 }
1655 if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
1656 PyErr_Clear();
1657 return 0;
1658 }
1659 return -1;
1660}
1661#endif
1662
1663

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected