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 /Include | |
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 'Include')
-rw-r--r-- | Include/objimpl.h | 4 | ||||
-rw-r--r-- | Include/pymem.h | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index 464b1bf93ba..1408d051ba7 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -38,7 +38,7 @@ Functions and macros for modules that implement new object types. 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 @@ PyAPI_FUNC(void) PyObject_Free(void *ptr); // 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 5b9dd421994..92cd5369589 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -79,13 +79,15 @@ PyAPI_FUNC(void) PyMem_Free(void *ptr); // 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 |