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

Function record_dealloc

asyncpg/protocol/record/recordobj.c:170–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170static void
171record_dealloc(PyObject *self)
172{
173 ApgRecordObject *o = (ApgRecordObject *)self;
174 Py_ssize_t i;
175 Py_ssize_t len = Py_SIZE(o);
176 PyTypeObject *tp = Py_TYPE(o);
177 record_module_state *state;
178 int skip_dealloc = 0;
179
180 state = find_module_state_by_def(tp);
181 if (state == NULL) {
182 return;
183 }
184
185 PyObject_GC_UnTrack(o);
186
187 o->self_hash = -1;
188
189 Py_CLEAR(o->desc);
190
191 Py_TRASHCAN_BEGIN(o, record_dealloc)
192
193 i = len;
194 while (--i >= 0) {
195 Py_XDECREF(o->ob_item[i]);
196 }
197
198 if (len < ApgRecord_MAXSAVESIZE && tp == state->ApgRecord_Type) {
199 record_freelist_state *freelist = get_freelist_state(state);
200 if (freelist != NULL && freelist->numfree[len] < ApgRecord_MAXFREELIST) {
201 o->ob_item[0] = (PyObject *)freelist->freelist[len];
202 freelist->numfree[len]++;
203 freelist->freelist[len] = o;
204 skip_dealloc = 1;
205 }
206 }
207
208 if (!skip_dealloc) {
209 tp->tp_free(self);
210 Py_DECREF(tp);
211 }
212
213 Py_TRASHCAN_END
214}
215
216static int
217record_traverse(PyObject *self, visitproc visit, void *arg)

Callers

nothing calls this directly

Calls 2

find_module_state_by_defFunction · 0.85
get_freelist_stateFunction · 0.85

Tested by

no test coverage detected