diff options
author | Victor Stinner <vstinner@python.org> | 2020-12-01 10:37:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 10:37:39 +0100 |
commit | 32bd68c839adb7b42af12366ab0892303115d1d1 (patch) | |
tree | 205358a43a500fedb97ad0e370fbc998b42b3ae7 /Modules | |
parent | bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586) (diff) | |
download | cpython-32bd68c839adb7b42af12366ab0892303115d1d1.tar.gz cpython-32bd68c839adb7b42af12366ab0892303115d1d1.tar.bz2 cpython-32bd68c839adb7b42af12366ab0892303115d1d1.zip |
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()
Diffstat (limited to 'Modules')
30 files changed, 46 insertions, 46 deletions
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c index 8e1acce56b1..5d108ed008a 100644 --- a/Modules/_blake2/blake2b_impl.c +++ b/Modules/_blake2/blake2b_impl.c @@ -393,7 +393,7 @@ py_blake2b_dealloc(PyObject *self) } 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 e1de5df37d0..85c2d4edad7 100644 --- a/Modules/_blake2/blake2s_impl.c +++ b/Modules/_blake2/blake2s_impl.c @@ -392,7 +392,7 @@ py_blake2s_dealloc(PyObject *self) } 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 9b629877a8a..40a05a44edd 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -475,7 +475,7 @@ static void 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 1a8f0b63682..7d252244e24 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -282,7 +282,7 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po) 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 a59858632e7..1f4789baf7a 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -689,7 +689,7 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo) 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 ea16c5a6cd9..9c85d76c6b5 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -1765,7 +1765,7 @@ ctxmanager_dealloc(PyDecContextManagerObject *self) { 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 9fad21fc332..ff03c334766 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -478,7 +478,7 @@ keyobject_dealloc(keyobject *ko) { Py_DECREF(ko->cmp); Py_XDECREF(ko->object); - PyObject_FREE(ko); + PyObject_Free(ko); } static int @@ -742,7 +742,7 @@ lru_list_elem_dealloc(lru_list_elem *link) { 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 7e176cf21d6..d4295d7c363 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -341,7 +341,7 @@ EVP_dealloc(EVPobject *self) 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 @@ _hashlib_hmac_new_impl(PyObject *module, Py_buffer *key, PyObject *msg_obj, error: if (ctx) HMAC_CTX_free(ctx); - if (self) PyObject_Del(self); + if (self) PyObject_Free(self); return NULL; } @@ -1546,7 +1546,7 @@ _hmac_dealloc(HMACobject *self) 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 8732750e11b..9a2d1f85c92 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -571,7 +571,7 @@ semlock_dealloc(SemLockObject* self) 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 7ecaeea18c6..5a8aad9de76 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -443,7 +443,7 @@ Pdata_dealloc(Pdata *self) 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 da6dde6812f..cae10f99d5b 100644 --- a/Modules/_sha3/sha3module.c +++ b/Modules/_sha3/sha3module.c @@ -274,7 +274,7 @@ SHA3_dealloc(SHA3object *self) } 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 c67f38d75b8..57faf7bdaae 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -571,7 +571,7 @@ pattern_dealloc(PatternObject* self) 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 @@ match_dealloc(MatchObject* self) 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 @@ scanner_dealloc(ScannerObject* self) 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 87fe3a16078..edb850ee461 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2295,7 +2295,7 @@ PySSL_dealloc(PySSLSocket *self) 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 d8321768bc9..1b4fb09fb8f 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -236,7 +236,7 @@ ndarray_dealloc(NDArrayObject *self) ndbuf_pop(self); } } - PyObject_Del(self); + PyObject_Free(self); } static int @@ -2734,7 +2734,7 @@ staticarray_init(PyObject *self, PyObject *args, PyObject *kwds) 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 916d10a1e41..d2104423c58 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -6010,7 +6010,7 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) static void test_structmembers_free(PyObject *ob) { - PyObject_FREE(ob); + PyObject_Free(ob); } static PyTypeObject test_structmembersType = { @@ -6664,7 +6664,7 @@ static void heapctype_dealloc(HeapCTypeObject *self) { PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -6854,7 +6854,7 @@ heapctypewithdict_dealloc(HeapCTypeWithDictObject* self) PyTypeObject *tp = Py_TYPE(self); Py_XDECREF(self->dict); - PyObject_DEL(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -6925,7 +6925,7 @@ heapctypewithweakref_dealloc(HeapCTypeWithWeakrefObject* self) 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 @@ static void 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 dcefa8dbaa9..86d5f544fcf 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -34,7 +34,7 @@ lock_dealloc(lockobject *self) 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 24aeb3da94c..46d6a6e0954 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -904,7 +904,7 @@ PyTclObject_dealloc(PyTclObject *self) 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 @@ Tktt_Dealloc(PyObject *self) Py_XDECREF(func); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -3096,7 +3096,7 @@ Tkapp_Dealloc(PyObject *self) 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 37a80a781da..9208b86b0c9 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -691,7 +691,7 @@ static struct PyMethodDef multibytecodec_methods[] = { 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 45201435f24..fdbba6a7afc 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -2290,7 +2290,7 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) } 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 @@ PyObject_GC_Del(void *op) 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 9bd2bd17e4f..1c401e88438 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -342,7 +342,7 @@ static void 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 2a1ac10814a..4f2d9cb8b7c 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -154,7 +154,7 @@ oss_dealloc(oss_audio_t *self) /* if already closed, don't reclose it */ if (self->fd != -1) close(self->fd); - PyObject_Del(self); + PyObject_Free(self); } @@ -199,7 +199,7 @@ oss_mixer_dealloc(oss_mixer_t *self) /* 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 3829932070a..38dd98f0848 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -722,7 +722,7 @@ Overlapped_dealloc(OverlappedObject *self) 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 0b9f20d6bbd..f80da589540 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -742,7 +742,7 @@ poll_dealloc(pollObject *self) 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 @@ devpoll_dealloc(devpollObject *self) 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 c22437de256..5209857041d 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -320,7 +320,7 @@ static void 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 edd4d010928..6b8bd8f1d27 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -397,7 +397,7 @@ static void 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 725098def4d..3fd9fa4c8d1 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -453,7 +453,7 @@ static void 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 cfe0a4af2c4..322f66fb4da 100644 --- a/Modules/sre_lib.h +++ b/Modules/sre_lib.h @@ -986,7 +986,7 @@ entrance: 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 @@ entrance: 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 fcf801dc9e4..4b8c46c7797 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -1418,7 +1418,7 @@ static void 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 17b049c4b9a..edcd62157c0 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -44,7 +44,7 @@ static void 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 def617671f1..a537087d19d 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -591,7 +591,7 @@ Dealloc(compobject *self) Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); Py_XDECREF(self->zdict); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(type); } |