summaryrefslogtreecommitdiffstats
path: root/Python
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 /Python
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 'Python')
-rw-r--r--Python/bltinmodule.c2
-rw-r--r--Python/getargs.c4
-rw-r--r--Python/marshal.c18
-rw-r--r--Python/pystrtod.c4
-rw-r--r--Python/traceback.c4
5 files changed, 16 insertions, 16 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 1ce55b6..a73b8cb 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2089,7 +2089,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
Py_DECREF(stdin_encoding);
Py_DECREF(stdin_errors);
Py_XDECREF(po);
- PyMem_FREE(s);
+ PyMem_Free(s);
if (result != NULL) {
if (PySys_Audit("builtins.input/result", "O", result) < 0) {
diff --git a/Python/getargs.c b/Python/getargs.c
index c85ff6d..8839492 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -202,7 +202,7 @@ static int
cleanup_ptr(PyObject *self, void *ptr)
{
if (ptr) {
- PyMem_FREE(ptr);
+ PyMem_Free(ptr);
}
return 0;
}
@@ -246,7 +246,7 @@ cleanreturn(int retval, freelist_t *freelist)
}
}
if (freelist->entries_malloced)
- PyMem_FREE(freelist->entries);
+ PyMem_Free(freelist->entries);
return retval;
}
diff --git a/Python/marshal.c b/Python/marshal.c
index d292987..fa4ec9e 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -638,7 +638,7 @@ r_string(Py_ssize_t n, RFILE *p)
return res;
}
if (p->buf == NULL) {
- p->buf = PyMem_MALLOC(n);
+ p->buf = PyMem_Malloc(n);
if (p->buf == NULL) {
PyErr_NoMemory();
return NULL;
@@ -646,7 +646,7 @@ r_string(Py_ssize_t n, RFILE *p)
p->buf_size = n;
}
else if (p->buf_size < n) {
- char *tmp = PyMem_REALLOC(p->buf, n);
+ char *tmp = PyMem_Realloc(p->buf, n);
if (tmp == NULL) {
PyErr_NoMemory();
return NULL;
@@ -1453,7 +1453,7 @@ PyMarshal_ReadShortFromFile(FILE *fp)
rf.buf = NULL;
res = r_short(&rf);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return res;
}
@@ -1468,7 +1468,7 @@ PyMarshal_ReadLongFromFile(FILE *fp)
rf.buf = NULL;
res = r_long(&rf);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return res;
}
@@ -1501,11 +1501,11 @@ PyMarshal_ReadLastObjectFromFile(FILE *fp)
off_t filesize;
filesize = getfilesize(fp);
if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) {
- char* pBuf = (char *)PyMem_MALLOC(filesize);
+ char* pBuf = (char *)PyMem_Malloc(filesize);
if (pBuf != NULL) {
size_t n = fread(pBuf, 1, (size_t)filesize, fp);
PyObject* v = PyMarshal_ReadObjectFromString(pBuf, n);
- PyMem_FREE(pBuf);
+ PyMem_Free(pBuf);
return v;
}
@@ -1534,7 +1534,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
result = r_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return result;
}
@@ -1555,7 +1555,7 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
result = r_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
return result;
}
@@ -1684,7 +1684,7 @@ marshal_load(PyObject *module, PyObject *file)
result = read_object(&rf);
Py_DECREF(rf.refs);
if (rf.buf != NULL)
- PyMem_FREE(rf.buf);
+ PyMem_Free(rf.buf);
} else
result = NULL;
}
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 1c8202c..9145d4e 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -255,7 +255,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
char *copy, *c;
/* Create a copy of the input, with the '.' converted to the
locale-specific decimal point */
- copy = (char *)PyMem_MALLOC(end - digits_pos +
+ copy = (char *)PyMem_Malloc(end - digits_pos +
1 + decimal_point_len);
if (copy == NULL) {
*endptr = (char *)nptr;
@@ -286,7 +286,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
(fail_pos - copy);
}
- PyMem_FREE(copy);
+ PyMem_Free(copy);
}
else {
diff --git a/Python/traceback.c b/Python/traceback.c
index 99b63af..708678f 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -419,12 +419,12 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
Py_DECREF(io);
Py_DECREF(binary);
- PyMem_FREE(found_encoding);
+ PyMem_Free(found_encoding);
return 0;
}
fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
Py_DECREF(io);
- PyMem_FREE(found_encoding);
+ PyMem_Free(found_encoding);
if (fob == NULL) {
PyErr_Clear();