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

Function PyDataMem_UserNEW_ZEROED

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

Source from the content-addressed store, hash-verified

454}
455
456NPY_NO_EXPORT void *
457PyDataMem_UserNEW_ZEROED(size_t nmemb, size_t size, PyObject *mem_handler)
458{
459 void *result;
460 PyDataMem_Handler *handler = (PyDataMem_Handler *) PyCapsule_GetPointer(mem_handler, "mem_handler");
461 if (handler == NULL) {
462 return NULL;
463 }
464 result = handler->allocator.calloc(handler->allocator.ctx, nmemb, size);
465 if (_PyDataMem_eventhook != NULL) {
466 NPY_ALLOW_C_API_DEF
467 NPY_ALLOW_C_API
468 if (_PyDataMem_eventhook != NULL) {
469 (*_PyDataMem_eventhook)(NULL, result, nmemb * size,
470 _PyDataMem_eventhook_user_data);
471 }
472 NPY_DISABLE_C_API
473 }
474 PyTraceMalloc_Track(NPY_TRACE_DOMAIN, (npy_uintp)result, nmemb * size);
475 return result;
476}
477
478
479NPY_NO_EXPORT void

Callers 1

PyArray_NewFromDescr_intFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected