bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)

No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 464b1bf..1408d05 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -38,7 +38,7 @@
    object with room for n items.  In addition to the refcount and type pointer
    fields, this also fills in the ob_size field.
 
- - PyObject_Del(op) releases the memory allocated for an object.  It does not
+ - PyObject_Free(op) releases the memory allocated for an object.  It does not
    run a destructor -- it only frees the memory.  PyObject_Free is identical.
 
  - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
@@ -103,6 +103,8 @@
 
 
 // Deprecated aliases only kept for backward compatibility.
+// PyObject_Del and PyObject_DEL are defined with no parameter to be able to
+// use them as function pointers (ex: tp_free = PyObject_Del).
 #define PyObject_MALLOC         PyObject_Malloc
 #define PyObject_REALLOC        PyObject_Realloc
 #define PyObject_FREE           PyObject_Free
diff --git a/Include/pymem.h b/Include/pymem.h
index 5b9dd42..92cd536 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -79,13 +79,15 @@
 
 
 // Deprecated aliases only kept for backward compatibility.
+// PyMem_Del and PyMem_DEL are defined with no parameter to be able to use
+// them as function pointers (ex: dealloc = PyMem_Del).
 #define PyMem_MALLOC(n)           PyMem_Malloc(n)
 #define PyMem_NEW(type, n)        PyMem_New(type, n)
 #define PyMem_REALLOC(p, n)       PyMem_Realloc(p, n)
 #define PyMem_RESIZE(p, type, n)  PyMem_Resize(p, type, n)
 #define PyMem_FREE(p)             PyMem_Free(p)
-#define PyMem_Del(p)              PyMem_Free(p)
-#define PyMem_DEL(p)              PyMem_Free(p)
+#define PyMem_Del                 PyMem_Free
+#define PyMem_DEL                 PyMem_Free
 
 
 #ifndef Py_LIMITED_API
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c
index 8e1acce..5d108ed 100644
--- a/Modules/_blake2/blake2b_impl.c
+++ b/Modules/_blake2/blake2b_impl.c
@@ -393,7 +393,7 @@
     }
 
     PyTypeObject *type = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
diff --git a/Modules/_blake2/blake2s_impl.c b/Modules/_blake2/blake2s_impl.c
index e1de5df..85c2d4e 100644
--- a/Modules/_blake2/blake2s_impl.c
+++ b/Modules/_blake2/blake2s_impl.c
@@ -392,7 +392,7 @@
     }
 
     PyTypeObject *type = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 9b62987..40a05a4 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -475,7 +475,7 @@
 PyCArg_dealloc(PyCArgObject *self)
 {
     Py_XDECREF(self->obj);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static int
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 1a8f0b6..7d25224 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -282,7 +282,7 @@
         Py_DECREF(po->wo);
         remove_lop(po);
     }
-    PyObject_DEL(po);
+    PyObject_Free(po);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index a598586..1f4789b 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -689,7 +689,7 @@
     if (wo->win != stdscr) delwin(wo->win);
     if (wo->encoding != NULL)
         PyMem_Free(wo->encoding);
-    PyObject_DEL(wo);
+    PyObject_Free(wo);
 }
 
 /* Addch, Addstr, Addnstr */
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index ea16c5a..9c85d76 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -1765,7 +1765,7 @@
 {
     Py_XDECREF(self->local);
     Py_XDECREF(self->global);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyObject *
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 9fad21f..ff03c33 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -478,7 +478,7 @@
 {
     Py_DECREF(ko->cmp);
     Py_XDECREF(ko->object);
-    PyObject_FREE(ko);
+    PyObject_Free(ko);
 }
 
 static int
@@ -742,7 +742,7 @@
 {
     Py_XDECREF(link->key);
     Py_XDECREF(link->result);
-    PyObject_Del(link);
+    PyObject_Free(link);
 }
 
 static PyTypeObject lru_list_elem_type = {
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 7e176cf..d4295d7 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -341,7 +341,7 @@
     if (self->lock != NULL)
         PyThread_free_lock(self->lock);
     EVP_MD_CTX_free(self->ctx);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -1453,7 +1453,7 @@
 
 error:
     if (ctx) HMAC_CTX_free(ctx);
-    if (self) PyObject_Del(self);
+    if (self) PyObject_Free(self);
     return NULL;
 }
 
@@ -1546,7 +1546,7 @@
         PyThread_free_lock(self->lock);
     }
     HMAC_CTX_free(self->ctx);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 8732750..9a2d1f8 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -571,7 +571,7 @@
     if (self->handle != SEM_FAILED)
         SEM_CLOSE(self->handle);
     PyMem_Free(self->name);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 /*[clinic input]
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 7ecaeea..5a8aad9 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -443,7 +443,7 @@
         Py_DECREF(self->data[i]);
     }
     PyMem_Free(self->data);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyTypeObject Pdata_Type = {
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index da6dde6..cae10f9 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -274,7 +274,7 @@
     }
 
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_sre.c b/Modules/_sre.c
index c67f38d..57faf7b 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -571,7 +571,7 @@
     Py_XDECREF(self->pattern);
     Py_XDECREF(self->groupindex);
     Py_XDECREF(self->indexgroup);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -1944,7 +1944,7 @@
     Py_XDECREF(self->regs);
     Py_XDECREF(self->string);
     Py_DECREF(self->pattern);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -2450,7 +2450,7 @@
 
     state_fini(&self->state);
     Py_XDECREF(self->pattern);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 87fe3a1..edb850e 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2295,7 +2295,7 @@
     Py_XDECREF(self->ctx);
     Py_XDECREF(self->server_hostname);
     Py_XDECREF(self->owner);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index d832176..1b4fb09 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -236,7 +236,7 @@
                 ndbuf_pop(self);
         }
     }
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static int
@@ -2734,7 +2734,7 @@
 static void
 staticarray_dealloc(StaticArrayObject *self)
 {
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 /* Return a buffer for a PyBUF_FULL_RO request. Flags are not checked,
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 916d10a..d210442 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -6010,7 +6010,7 @@
 static void
 test_structmembers_free(PyObject *ob)
 {
-    PyObject_FREE(ob);
+    PyObject_Free(ob);
 }
 
 static PyTypeObject test_structmembersType = {
@@ -6664,7 +6664,7 @@
 heapctype_dealloc(HeapCTypeObject *self)
 {
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6854,7 +6854,7 @@
 
     PyTypeObject *tp = Py_TYPE(self);
     Py_XDECREF(self->dict);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6925,7 +6925,7 @@
     if (self->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) self);
     Py_XDECREF(self->weakreflist);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6968,7 +6968,7 @@
 heapctypesetattr_dealloc(HeapCTypeSetattrObject *self)
 {
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index dcefa8d..86d5f54 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -34,7 +34,7 @@
             PyThread_release_lock(self->lock_lock);
         PyThread_free_lock(self->lock_lock);
     }
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 /* Helper to acquire an interruptible lock with a timeout.  If the lock acquire
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 24aeb3d..46d6a6e 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -904,7 +904,7 @@
     PyObject *tp = (PyObject *) Py_TYPE(self);
     Tcl_DecrRefCount(self->value);
     Py_XDECREF(self->string);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -2823,7 +2823,7 @@
 
     Py_XDECREF(func);
 
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -3096,7 +3096,7 @@
     ENTER_TCL
     Tcl_DeleteInterp(Tkapp_Interp(self));
     LEAVE_TCL
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
     DisableEventHook();
 }
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 37a80a7..9208b86 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -691,7 +691,7 @@
 static void
 multibytecodec_dealloc(MultibyteCodecObject *self)
 {
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyTypeObject MultibyteCodec_Type = {
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 4520143..fdbba6a 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -2290,7 +2290,7 @@
     }
 
     PyGC_Head *g = AS_GC(op);
-    g = (PyGC_Head *)PyObject_REALLOC(g,  sizeof(PyGC_Head) + basicsize);
+    g = (PyGC_Head *)PyObject_Realloc(g,  sizeof(PyGC_Head) + basicsize);
     if (g == NULL)
         return (PyVarObject *)PyErr_NoMemory();
     op = (PyVarObject *) FROM_GC(g);
@@ -2309,7 +2309,7 @@
     if (gcstate->generations[0].count > 0) {
         gcstate->generations[0].count--;
     }
-    PyObject_FREE(g);
+    PyObject_Free(g);
 }
 
 int
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 9bd2bd1..1c401e8 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -342,7 +342,7 @@
 MD5_dealloc(PyObject *ptr)
 {
     PyTypeObject *tp = Py_TYPE(ptr);
-    PyObject_Del(ptr);
+    PyObject_Free(ptr);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 2a1ac10..4f2d9cb 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -154,7 +154,7 @@
     /* if already closed, don't reclose it */
     if (self->fd != -1)
         close(self->fd);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 
@@ -199,7 +199,7 @@
     /* if already closed, don't reclose it */
     if (self->fd != -1)
         close(self->fd);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 3829932..38dd98f 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -722,7 +722,7 @@
     SetLastError(olderr);
 
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 0b9f20d..f80da58 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -742,7 +742,7 @@
     if (self->ufds != NULL)
         PyMem_Free(self->ufds);
     Py_XDECREF(self->dict);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
@@ -1130,7 +1130,7 @@
     PyObject *type = (PyObject *)Py_TYPE(self);
     (void)devpoll_internal_close(self);
     PyMem_Free(self->fds);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index c22437d..52098570 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -320,7 +320,7 @@
 SHA1_dealloc(PyObject *ptr)
 {
     PyTypeObject *tp = Py_TYPE(ptr);
-    PyObject_Del(ptr);
+    PyObject_Free(ptr);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index edd4d01..6b8bd8f 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -397,7 +397,7 @@
 SHA_dealloc(PyObject *ptr)
 {
     PyTypeObject *tp = Py_TYPE(ptr);
-    PyObject_Del(ptr);
+    PyObject_Free(ptr);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 725098d..3fd9fa4 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -453,7 +453,7 @@
 SHA512_dealloc(PyObject *ptr)
 {
     PyTypeObject *tp = Py_TYPE(ptr);
-    PyObject_Del(ptr);
+    PyObject_Free(ptr);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h
index cfe0a4a..322f66f 100644
--- a/Modules/sre_lib.h
+++ b/Modules/sre_lib.h
@@ -986,7 +986,7 @@
                    ctx->pattern[1], ctx->pattern[2]));
 
             /* install new repeat context */
-            ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
+            ctx->u.rep = (SRE_REPEAT*) PyObject_Malloc(sizeof(*ctx->u.rep));
             if (!ctx->u.rep) {
                 PyErr_NoMemory();
                 RETURN_FAILURE;
@@ -1000,7 +1000,7 @@
             state->ptr = ctx->ptr;
             DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]);
             state->repeat = ctx->u.rep->prev;
-            PyObject_FREE(ctx->u.rep);
+            PyObject_Free(ctx->u.rep);
 
             if (ret) {
                 RETURN_ON_ERROR(ret);
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index fcf801d..4b8c46c 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -1418,7 +1418,7 @@
 ucd_dealloc(PreviousDBVersion *self)
 {
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c
index 17b049c..edcd621 100644
--- a/Modules/xxmodule.c
+++ b/Modules/xxmodule.c
@@ -44,7 +44,7 @@
 Xxo_dealloc(XxoObject *self)
 {
     Py_XDECREF(self->x_attr);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyObject *
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index def6176..a537087 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -591,7 +591,7 @@
     Py_XDECREF(self->unused_data);
     Py_XDECREF(self->unconsumed_tail);
     Py_XDECREF(self->zdict);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index bb84409..13216b9 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -198,7 +198,7 @@
     }
 
     /* Inline PyObject_NewVar */
-    op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
+    op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + size);
     if (op == NULL) {
         return PyErr_NoMemory();
     }
@@ -1475,7 +1475,7 @@
             "repeated bytes are too long");
         return NULL;
     }
-    op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes);
+    op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + nbytes);
     if (op == NULL) {
         return PyErr_NoMemory();
     }
@@ -3054,9 +3054,9 @@
     _Py_ForgetReference(v);
 #endif
     *pv = (PyObject *)
-        PyObject_REALLOC(v, PyBytesObject_SIZE + newsize);
+        PyObject_Realloc(v, PyBytesObject_SIZE + newsize);
     if (*pv == NULL) {
-        PyObject_Del(v);
+        PyObject_Free(v);
         PyErr_NoMemory();
         return -1;
     }
diff --git a/Objects/capsule.c b/Objects/capsule.c
index a2ff642..800a6c4 100644
--- a/Objects/capsule.c
+++ b/Objects/capsule.c
@@ -260,7 +260,7 @@
     if (capsule->destructor) {
         capsule->destructor(o);
     }
-    PyObject_DEL(o);
+    PyObject_Free(o);
 }
 
 
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 0257295..0b0b8f9 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -669,7 +669,7 @@
         PyObject_GC_Del(co->co_zombieframe);
     if (co->co_weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject*)co);
-    PyObject_DEL(co);
+    PyObject_Free(co);
 }
 
 static PyObject *
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index a481d9a..a65ebdf 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -233,7 +233,7 @@
 PyComplex_FromCComplex(Py_complex cval)
 {
     /* Inline PyObject_New */
-    PyComplexObject *op = PyObject_MALLOC(sizeof(PyComplexObject));
+    PyComplexObject *op = PyObject_Malloc(sizeof(PyComplexObject));
     if (op == NULL) {
         return PyErr_NoMemory();
     }
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index ee1a9d1..7a37313 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -269,7 +269,7 @@
         PyObject_GC_Del(op);
     }
     while (state->keys_numfree) {
-        PyObject_FREE(state->keys_free_list[--state->keys_numfree]);
+        PyObject_Free(state->keys_free_list[--state->keys_numfree]);
     }
 }
 
@@ -597,7 +597,7 @@
     }
     else
     {
-        dk = PyObject_MALLOC(sizeof(PyDictKeysObject)
+        dk = PyObject_Malloc(sizeof(PyDictKeysObject)
                              + es * size
                              + sizeof(PyDictKeyEntry) * usable);
         if (dk == NULL) {
@@ -636,7 +636,7 @@
         state->keys_free_list[state->keys_numfree++] = keys;
         return;
     }
-    PyObject_FREE(keys);
+    PyObject_Free(keys);
 }
 
 #define new_values(size) PyMem_NEW(PyObject *, size)
@@ -1303,7 +1303,7 @@
             state->keys_free_list[state->keys_numfree++] = oldkeys;
         }
         else {
-            PyObject_FREE(oldkeys);
+            PyObject_Free(oldkeys);
         }
     }
 
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 1550b2e..34fb57a 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -237,7 +237,7 @@
         assert(state->numfree != -1);
 #endif
         if (state->numfree >= PyFloat_MAXFREELIST)  {
-            PyObject_FREE(op);
+            PyObject_Free(op);
             return;
         }
         state->numfree++;
@@ -2032,7 +2032,7 @@
     PyFloatObject *f = state->free_list;
     while (f != NULL) {
         PyFloatObject *next = (PyFloatObject*) Py_TYPE(f);
-        PyObject_FREE(f);
+        PyObject_Free(f);
         f = next;
     }
     state->free_list = NULL;
diff --git a/Objects/longobject.c b/Objects/longobject.c
index e0d6410..240e92a 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -131,7 +131,7 @@
                         "too many digits in integer");
         return NULL;
     }
-    result = PyObject_MALLOC(offsetof(PyLongObject, ob_digit) +
+    result = PyObject_Malloc(offsetof(PyLongObject, ob_digit) +
                              size*sizeof(digit));
     if (!result) {
         PyErr_NoMemory();
diff --git a/Objects/object.c b/Objects/object.c
index 2e8717f..0a8621b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -161,7 +161,7 @@
 PyObject *
 _PyObject_New(PyTypeObject *tp)
 {
-    PyObject *op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp));
+    PyObject *op = (PyObject *) PyObject_Malloc(_PyObject_SIZE(tp));
     if (op == NULL) {
         return PyErr_NoMemory();
     }
@@ -174,7 +174,7 @@
 {
     PyVarObject *op;
     const size_t size = _PyObject_VAR_SIZE(tp, nitems);
-    op = (PyVarObject *) PyObject_MALLOC(size);
+    op = (PyVarObject *) PyObject_Malloc(size);
     if (op == NULL) {
         return (PyVarObject *)PyErr_NoMemory();
     }
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 83b326b..4eb15f9 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -459,7 +459,7 @@
 - implement a fuller MutableMapping API in C?
 - move the MutableMapping implementation to abstract.c?
 - optimize mutablemapping_update
-- use PyObject_MALLOC (small object allocator) for odict nodes?
+- use PyObject_Malloc (small object allocator) for odict nodes?
 - support subclasses better (e.g. in odict_richcompare)
 
 */
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 787d113..530426c 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -171,7 +171,7 @@
     Py_DECREF(r->stop);
     Py_DECREF(r->step);
     Py_DECREF(r->length);
-    PyObject_Del(r);
+    PyObject_Free(r);
 }
 
 /* Return number of items in range (lo, hi, step) as a PyLong object,
@@ -1021,7 +1021,7 @@
     Py_XDECREF(r->start);
     Py_XDECREF(r->step);
     Py_XDECREF(r->len);
-    PyObject_Del(r);
+    PyObject_Free(r);
 }
 
 static PyObject *
diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h
index b526ad2..7152ec6 100644
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -983,7 +983,7 @@
 formatteriter_dealloc(formatteriterobject *it)
 {
     Py_XDECREF(it->str);
-    PyObject_FREE(it);
+    PyObject_Free(it);
 }
 
 /* returns a tuple:
@@ -1147,7 +1147,7 @@
 fieldnameiter_dealloc(fieldnameiterobject *it)
 {
     Py_XDECREF(it->str);
-    PyObject_FREE(it);
+    PyObject_Free(it);
 }
 
 /* returns a tuple:
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index fbadd31..83bc877 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1059,7 +1059,7 @@
         obj = _PyObject_GC_Malloc(size);
     }
     else {
-        obj = (PyObject *)PyObject_MALLOC(size);
+        obj = (PyObject *)PyObject_Malloc(size);
     }
 
     if (obj == NULL) {
@@ -2707,7 +2707,7 @@
                 goto error;
             /* Silently truncate the docstring if it contains null bytes. */
             len = strlen(doc_str);
-            tp_doc = (char *)PyObject_MALLOC(len + 1);
+            tp_doc = (char *)PyObject_Malloc(len + 1);
             if (tp_doc == NULL) {
                 PyErr_NoMemory();
                 goto error;
@@ -3047,7 +3047,7 @@
                 continue;
             }
             size_t len = strlen(slot->pfunc)+1;
-            char *tp_doc = PyObject_MALLOC(len);
+            char *tp_doc = PyObject_Malloc(len);
             if (tp_doc == NULL) {
                 type->tp_doc = NULL;
                 PyErr_NoMemory();
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ba6d07a..f6473c0 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1061,7 +1061,7 @@
     new_size = (struct_size + (length + 1) * char_size);
 
     if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_UTF8(unicode));
+        PyObject_Free(_PyUnicode_UTF8(unicode));
         _PyUnicode_UTF8(unicode) = NULL;
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
     }
@@ -1072,7 +1072,7 @@
     _Py_ForgetReference(unicode);
 #endif
 
-    new_unicode = (PyObject *)PyObject_REALLOC(unicode, new_size);
+    new_unicode = (PyObject *)PyObject_Realloc(unicode, new_size);
     if (new_unicode == NULL) {
         _Py_NewReference(unicode);
         PyErr_NoMemory();
@@ -1088,7 +1088,7 @@
             _PyUnicode_WSTR_LENGTH(unicode) = length;
     }
     else if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         if (!PyUnicode_IS_ASCII(unicode))
             _PyUnicode_WSTR_LENGTH(unicode) = 0;
@@ -1131,12 +1131,12 @@
 
         if (!share_utf8 && _PyUnicode_HAS_UTF8_MEMORY(unicode))
         {
-            PyObject_DEL(_PyUnicode_UTF8(unicode));
+            PyObject_Free(_PyUnicode_UTF8(unicode));
             _PyUnicode_UTF8(unicode) = NULL;
             _PyUnicode_UTF8_LENGTH(unicode) = 0;
         }
 
-        data = (PyObject *)PyObject_REALLOC(data, new_size);
+        data = (PyObject *)PyObject_Realloc(data, new_size);
         if (data == NULL) {
             PyErr_NoMemory();
             return -1;
@@ -1169,7 +1169,7 @@
     }
     new_size = sizeof(wchar_t) * (length + 1);
     wstr =  _PyUnicode_WSTR(unicode);
-    wstr = PyObject_REALLOC(wstr, new_size);
+    wstr = PyObject_Realloc(wstr, new_size);
     if (!wstr) {
         PyErr_NoMemory();
         return -1;
@@ -1259,7 +1259,7 @@
     _PyUnicode_UTF8(unicode) = NULL;
     _PyUnicode_UTF8_LENGTH(unicode) = 0;
 
-    _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_MALLOC(new_size);
+    _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_Malloc(new_size);
     if (!_PyUnicode_WSTR(unicode)) {
         Py_DECREF(unicode);
         PyErr_NoMemory();
@@ -1456,7 +1456,7 @@
      * PyObject_New() so we are able to allocate space for the object and
      * it's data buffer.
      */
-    obj = (PyObject *) PyObject_MALLOC(struct_size + (size + 1) * char_size);
+    obj = (PyObject *) PyObject_Malloc(struct_size + (size + 1) * char_size);
     if (obj == NULL) {
         return PyErr_NoMemory();
     }
@@ -1838,7 +1838,7 @@
         return -1;
 
     if (maxchar < 256) {
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(_PyUnicode_WSTR_LENGTH(unicode) + 1);
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(_PyUnicode_WSTR_LENGTH(unicode) + 1);
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
             return -1;
@@ -1859,7 +1859,7 @@
             _PyUnicode_UTF8(unicode) = NULL;
             _PyUnicode_UTF8_LENGTH(unicode) = 0;
         }
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
     }
@@ -1879,7 +1879,7 @@
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
 #else
         /* sizeof(wchar_t) == 4 */
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(
             2 * (_PyUnicode_WSTR_LENGTH(unicode) + 1));
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
@@ -1893,7 +1893,7 @@
         _PyUnicode_STATE(unicode).kind = PyUnicode_2BYTE_KIND;
         _PyUnicode_UTF8(unicode) = NULL;
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
 #endif
@@ -1908,7 +1908,7 @@
             PyErr_NoMemory();
             return -1;
         }
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(4 * (length_wo_surrogates + 1));
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(4 * (length_wo_surrogates + 1));
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
             return -1;
@@ -1920,7 +1920,7 @@
         /* unicode_convert_wchar_to_ucs4() requires a ready string */
         _PyUnicode_STATE(unicode).ready = 1;
         unicode_convert_wchar_to_ucs4(_PyUnicode_WSTR(unicode), end, unicode);
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
 #else
@@ -1973,13 +1973,13 @@
     }
 
     if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
     }
     if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_UTF8(unicode));
+        PyObject_Free(_PyUnicode_UTF8(unicode));
     }
     if (!PyUnicode_IS_COMPACT(unicode) && _PyUnicode_DATA_ANY(unicode)) {
-        PyObject_DEL(_PyUnicode_DATA_ANY(unicode));
+        PyObject_Free(_PyUnicode_DATA_ANY(unicode));
     }
 
     Py_TYPE(unicode)->tp_free(unicode);
@@ -4199,7 +4199,7 @@
             PyErr_NoMemory();
             return NULL;
         }
-        w = (wchar_t *) PyObject_MALLOC(sizeof(wchar_t) * (wlen + 1));
+        w = (wchar_t *) PyObject_Malloc(sizeof(wchar_t) * (wlen + 1));
         if (w == NULL) {
             PyErr_NoMemory();
             return NULL;
@@ -5627,7 +5627,7 @@
                     PyBytes_AS_STRING(writer.buffer);
     Py_ssize_t len = end - start;
 
-    char *cache = PyObject_MALLOC(len + 1);
+    char *cache = PyObject_Malloc(len + 1);
     if (cache == NULL) {
         _PyBytesWriter_Dealloc(&writer);
         PyErr_NoMemory();
@@ -8544,7 +8544,7 @@
     }
 
     /* Create a three-level trie */
-    result = PyObject_MALLOC(sizeof(struct encoding_map) +
+    result = PyObject_Malloc(sizeof(struct encoding_map) +
                              16*count2 + 128*count3 - 1);
     if (!result) {
         return PyErr_NoMemory();
@@ -15567,7 +15567,7 @@
         PyErr_NoMemory();
         goto onError;
     }
-    data = PyObject_MALLOC((length + 1) * char_size);
+    data = PyObject_Malloc((length + 1) * char_size);
     if (data == NULL) {
         PyErr_NoMemory();
         goto onError;
diff --git a/PC/_msi.c b/PC/_msi.c
index 504899d..01516e8 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -351,7 +351,7 @@
 {
     MsiCloseHandle(msidb->h);
     msidb->h = 0;
-    PyObject_Del(msidb);
+    PyObject_Free(msidb);
 }
 
 static PyObject*
diff --git a/PC/winreg.c b/PC/winreg.c
index fee51ac..d62a7be 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -145,7 +145,7 @@
     PyHKEYObject *obkey = (PyHKEYObject *)ob;
     if (obkey->hkey)
         RegCloseKey((HKEY)obkey->hkey);
-    PyObject_DEL(ob);
+    PyObject_Free(ob);
 }
 
 static int
@@ -459,7 +459,7 @@
 PyHKEY_FromHKEY(HKEY h)
 {
     /* Inline PyObject_New */
-    PyHKEYObject *op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject));
+    PyHKEYObject *op = (PyHKEYObject *) PyObject_Malloc(sizeof(PyHKEYObject));
     if (op == NULL) {
         return PyErr_NoMemory();
     }
diff --git a/Python/symtable.c b/Python/symtable.c
index 0464cd8..cce1b1b 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -128,7 +128,7 @@
     Py_XDECREF(ste->ste_varnames);
     Py_XDECREF(ste->ste_children);
     Py_XDECREF(ste->ste_directives);
-    PyObject_Del(ste);
+    PyObject_Free(ste);
 }
 
 #define OFF(x) offsetof(PySTEntryObject, x)