@@ -57,7 +57,7 @@ _append_new(int **p_types, int insert)
5757 while (types [n ] != NPY_NOTYPE ) {
5858 n ++ ;
5959 }
60- newtypes = (int * )realloc (types , (n + 2 )* sizeof (int ));
60+ newtypes = (int * )PyMem_RawRealloc (types , (n + 2 )* sizeof (int ));
6161 if (newtypes == NULL ) {
6262 PyErr_NoMemory ();
6363 return -1 ;
@@ -281,7 +281,7 @@ PyArray_RegisterDataType(PyArray_DescrProto *descr_proto)
281281 }
282282 }
283283
284- userdescrs = realloc (userdescrs ,
284+ userdescrs = PyMem_RawRealloc (userdescrs ,
285285 (NPY_NUMUSERTYPES + 1 )* sizeof (void * ));
286286 if (userdescrs == NULL ) {
287287 PyErr_SetString (PyExc_MemoryError , "RegisterDataType" );
@@ -484,7 +484,7 @@ PyArray_RegisterCanCast(PyArray_Descr *descr, int totype,
484484 * -- they become part of the data-type
485485 */
486486 if (PyDataType_GetArrFuncs (descr )-> cancastto == NULL ) {
487- PyDataType_GetArrFuncs (descr )-> cancastto = (int * )malloc (1 * sizeof (int ));
487+ PyDataType_GetArrFuncs (descr )-> cancastto = (int * )PyMem_RawMalloc (1 * sizeof (int ));
488488 if (PyDataType_GetArrFuncs (descr )-> cancastto == NULL ) {
489489 PyErr_NoMemory ();
490490 return -1 ;
@@ -498,7 +498,7 @@ PyArray_RegisterCanCast(PyArray_Descr *descr, int totype,
498498 if (PyDataType_GetArrFuncs (descr )-> cancastscalarkindto == NULL ) {
499499 int i ;
500500 PyDataType_GetArrFuncs (descr )-> cancastscalarkindto =
501- (int * * )malloc (NPY_NSCALARKINDS * sizeof (int * ));
501+ (int * * )PyMem_RawMalloc (NPY_NSCALARKINDS * sizeof (int * ));
502502 if (PyDataType_GetArrFuncs (descr )-> cancastscalarkindto == NULL ) {
503503 PyErr_NoMemory ();
504504 return -1 ;
@@ -509,7 +509,7 @@ PyArray_RegisterCanCast(PyArray_Descr *descr, int totype,
509509 }
510510 if (PyDataType_GetArrFuncs (descr )-> cancastscalarkindto [scalar ] == NULL ) {
511511 PyDataType_GetArrFuncs (descr )-> cancastscalarkindto [scalar ] =
512- (int * )malloc (1 * sizeof (int ));
512+ (int * )PyMem_RawMalloc (1 * sizeof (int ));
513513 if (PyDataType_GetArrFuncs (descr )-> cancastscalarkindto [scalar ] == NULL ) {
514514 PyErr_NoMemory ();
515515 return -1 ;
0 commit comments