summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-12-01 08:56:42 (GMT)
committerGitHub <noreply@github.com>2020-12-01 08:56:42 (GMT)
commit00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0 (patch)
tree26ebb0fe409768193bb85be90c0229a0f44d6f8e /Modules/_pickle.c
parentb2d0c66e881301ed8908da3cb41bbf253c449b0c (diff)
downloadcpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.zip
cpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.tar.gz
cpython-00d7abd7ef588fc4ff0571c8579ab4aba8ada1c0.tar.bz2
bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)
No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index ed8afef..7ecaeea 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -442,7 +442,7 @@ Pdata_dealloc(Pdata *self)
while (--i >= 0) {
Py_DECREF(self->data[i]);
}
- PyMem_FREE(self->data);
+ PyMem_Free(self->data);
PyObject_Del(self);
}
@@ -465,7 +465,7 @@ Pdata_New(void)
self->mark_set = 0;
self->fence = 0;
self->allocated = 8;
- self->data = PyMem_MALLOC(self->allocated * sizeof(PyObject *));
+ self->data = PyMem_Malloc(self->allocated * sizeof(PyObject *));
if (self->data)
return (PyObject *)self;
Py_DECREF(self);
@@ -726,7 +726,7 @@ static PyTypeObject Unpickler_Type;
static PyMemoTable *
PyMemoTable_New(void)
{
- PyMemoTable *memo = PyMem_MALLOC(sizeof(PyMemoTable));
+ PyMemoTable *memo = PyMem_Malloc(sizeof(PyMemoTable));
if (memo == NULL) {
PyErr_NoMemory();
return NULL;
@@ -735,9 +735,9 @@ PyMemoTable_New(void)
memo->mt_used = 0;
memo->mt_allocated = MT_MINSIZE;
memo->mt_mask = MT_MINSIZE - 1;
- memo->mt_table = PyMem_MALLOC(MT_MINSIZE * sizeof(PyMemoEntry));
+ memo->mt_table = PyMem_Malloc(MT_MINSIZE * sizeof(PyMemoEntry));
if (memo->mt_table == NULL) {
- PyMem_FREE(memo);
+ PyMem_Free(memo);
PyErr_NoMemory();
return NULL;
}
@@ -758,10 +758,10 @@ PyMemoTable_Copy(PyMemoTable *self)
new->mt_mask = self->mt_mask;
/* The table we get from _New() is probably smaller than we wanted.
Free it and allocate one that's the right size. */
- PyMem_FREE(new->mt_table);
+ PyMem_Free(new->mt_table);
new->mt_table = PyMem_NEW(PyMemoEntry, self->mt_allocated);
if (new->mt_table == NULL) {
- PyMem_FREE(new);
+ PyMem_Free(new);
PyErr_NoMemory();
return NULL;
}
@@ -800,8 +800,8 @@ PyMemoTable_Del(PyMemoTable *self)
return;
PyMemoTable_Clear(self);
- PyMem_FREE(self->mt_table);
- PyMem_FREE(self);
+ PyMem_Free(self->mt_table);
+ PyMem_Free(self);
}
/* Since entries cannot be deleted from this hashtable, _PyMemoTable_Lookup()
@@ -880,7 +880,7 @@ _PyMemoTable_ResizeTable(PyMemoTable *self, size_t min_size)
}
/* Deallocate the old table. */
- PyMem_FREE(oldtable);
+ PyMem_Free(oldtable);
return 0;
}
@@ -1582,7 +1582,7 @@ _Unpickler_MemoCleanup(UnpicklerObject *self)
while (--i >= 0) {
Py_XDECREF(memo[i]);
}
- PyMem_FREE(memo);
+ PyMem_Free(memo);
}
static UnpicklerObject *
@@ -7544,7 +7544,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj, void *Py_UNUSED(ignored
for (size_t i = new_memo_size - 1; i != SIZE_MAX; i--) {
Py_XDECREF(new_memo[i]);
}
- PyMem_FREE(new_memo);
+ PyMem_Free(new_memo);
}
return -1;
}