| 1133 | |
| 1134 | |
| 1135 | static void |
| 1136 | npyiter_dealloc(NewNpyArrayIterObject *self) |
| 1137 | { |
| 1138 | if (self->iter) { |
| 1139 | /* Store error, so that WriteUnraisable cannot clear an existing one */ |
| 1140 | PyObject *exc, *val, *tb; |
| 1141 | PyErr_Fetch(&exc, &val, &tb); |
| 1142 | if (npyiter_has_writeback(self->iter)) { |
| 1143 | if (PyErr_WarnEx(PyExc_RuntimeWarning, |
| 1144 | "Temporary data has not been written back to one of the " |
| 1145 | "operands. Typically nditer is used as a context manager " |
| 1146 | "otherwise 'close' must be called before reading iteration " |
| 1147 | "results.", 1) < 0) { |
| 1148 | PyObject *s; |
| 1149 | |
| 1150 | s = PyUnicode_FromString("npyiter_dealloc"); |
| 1151 | if (s) { |
| 1152 | PyErr_WriteUnraisable(s); |
| 1153 | Py_DECREF(s); |
| 1154 | } |
| 1155 | else { |
| 1156 | PyErr_WriteUnraisable(Py_None); |
| 1157 | } |
| 1158 | } |
| 1159 | } |
| 1160 | if (!NpyIter_Deallocate(self->iter)) { |
| 1161 | PyErr_WriteUnraisable(Py_None); |
| 1162 | } |
| 1163 | self->iter = NULL; |
| 1164 | Py_XDECREF(self->nested_child); |
| 1165 | self->nested_child = NULL; |
| 1166 | PyErr_Restore(exc, val, tb); |
| 1167 | } |
| 1168 | Py_TYPE(self)->tp_free((PyObject*)self); |
| 1169 | } |
| 1170 | |
| 1171 | static int |
| 1172 | npyiter_resetbasepointers(NewNpyArrayIterObject *self) |
nothing calls this directly
no test coverage detected