| 1411 | |
| 1412 | // This implementation needs the definition of `class cpp_function`. |
| 1413 | inline void tp_dealloc_impl(PyObject *self) { |
| 1414 | // Save type before PyObject_Free invalidates self. |
| 1415 | auto *type = Py_TYPE(self); |
| 1416 | auto *py_func_rec = reinterpret_cast<function_record_PyObject *>(self); |
| 1417 | cpp_function::destruct(py_func_rec->cpp_func_rec); |
| 1418 | py_func_rec->cpp_func_rec = nullptr; |
| 1419 | // PyObject_New increments the heap type refcount and allocates via |
| 1420 | // PyObject_Malloc; balance both here |
| 1421 | PyObject_Free(self); |
| 1422 | Py_DECREF(type); |
| 1423 | } |
| 1424 | |
| 1425 | PYBIND11_NAMESPACE_END(function_record_PyTypeObject_methods) |
| 1426 |
nothing calls this directly
no outgoing calls
no test coverage detected