| 892 | } |
| 893 | |
| 894 | static PyObject * |
| 895 | record_items_next(ApgRecordItemsObject *it) |
| 896 | { |
| 897 | ApgRecordObject *seq; |
| 898 | PyObject *key; |
| 899 | PyObject *val; |
| 900 | PyObject *tup; |
| 901 | |
| 902 | assert(it != NULL); |
| 903 | seq = it->it_seq; |
| 904 | if (seq == NULL) { |
| 905 | return NULL; |
| 906 | } |
| 907 | assert(it->it_key_iter != NULL); |
| 908 | |
| 909 | key = PyIter_Next(it->it_key_iter); |
| 910 | if (key == NULL) { |
| 911 | /* likely it_key_iter had less items than seq has values */ |
| 912 | goto exhausted; |
| 913 | } |
| 914 | |
| 915 | if (it->it_index < Py_SIZE(seq)) { |
| 916 | val = ApgRecord_GET_ITEM(seq, it->it_index); |
| 917 | ++it->it_index; |
| 918 | Py_INCREF(val); |
| 919 | } |
| 920 | else { |
| 921 | /* it_key_iter had more items than seq has values */ |
| 922 | Py_DECREF(key); |
| 923 | goto exhausted; |
| 924 | } |
| 925 | |
| 926 | tup = PyTuple_New(2); |
| 927 | if (tup == NULL) { |
| 928 | Py_DECREF(val); |
| 929 | Py_DECREF(key); |
| 930 | goto exhausted; |
| 931 | } |
| 932 | |
| 933 | PyTuple_SET_ITEM(tup, 0, key); |
| 934 | PyTuple_SET_ITEM(tup, 1, val); |
| 935 | return tup; |
| 936 | |
| 937 | exhausted: |
| 938 | Py_CLEAR(it->it_key_iter); |
| 939 | Py_CLEAR(it->it_seq); |
| 940 | return NULL; |
| 941 | } |
| 942 | |
| 943 | static PyObject * |
| 944 | record_items_len(ApgRecordItemsObject *it) |
nothing calls this directly
no outgoing calls
no test coverage detected