MCPcopy Create free account
hub / github.com/numpy/numpy / PyDataMem_SetEventHook

Function PyDataMem_SetEventHook

numpy/core/src/multiarray/alloc.c:253–272  ·  view source on GitHub ↗

NUMPY_API * Sets the allocation event hook for numpy array data. * Takes a PyDataMem_EventHookFunc *, which has the signature: * void hook(void *old, void *new, size_t size, void *user_data). * Also takes a void *user_data, and void **old_data. * * Returns a pointer to the previous hook or NULL. If old_data is * non-NULL, the previous user_data pointer will be copied to it. * *

Source from the content-addressed store, hash-verified

251 * Deprecated in 1.23
252 */
253NPY_NO_EXPORT PyDataMem_EventHookFunc *
254PyDataMem_SetEventHook(PyDataMem_EventHookFunc *newhook,
255 void *user_data, void **old_data)
256{
257 PyDataMem_EventHookFunc *temp;
258 NPY_ALLOW_C_API_DEF
259 NPY_ALLOW_C_API
260 /* 2021-11-18, 1.23 */
261 WARN_NO_RETURN(PyExc_DeprecationWarning,
262 "PyDataMem_SetEventHook is deprecated, use tracemalloc "
263 "and the 'np.lib.tracemalloc_domain' domain");
264 temp = _PyDataMem_eventhook;
265 _PyDataMem_eventhook = newhook;
266 if (old_data != NULL) {
267 *old_data = _PyDataMem_eventhook_user_data;
268 }
269 _PyDataMem_eventhook_user_data = user_data;
270 NPY_DISABLE_C_API
271 return temp;
272}
273
274/*NUMPY_API
275 * Allocates memory for array data.

Callers

nothing calls this directly

Calls 1

WARN_NO_RETURNFunction · 0.85

Tested by

no test coverage detected