mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initialization
* Replace malloc() with PyMem_RawMalloc() * Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held. * _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead of PyMem_Malloc()
This commit is contained in:
parent
51fa458d0a
commit
1a7425f67a
8 changed files with 76 additions and 76 deletions
|
@ -3316,7 +3316,7 @@ encode_error:
|
|||
wstr = _Py_char2wchar(errmsg, &errlen);
|
||||
if (wstr != NULL) {
|
||||
reason = PyUnicode_FromWideChar(wstr, errlen);
|
||||
PyMem_Free(wstr);
|
||||
PyMem_RawFree(wstr);
|
||||
} else
|
||||
errmsg = NULL;
|
||||
}
|
||||
|
@ -3535,7 +3535,7 @@ PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len,
|
|||
}
|
||||
|
||||
unicode = PyUnicode_FromWideChar(wstr, wlen);
|
||||
PyMem_Free(wstr);
|
||||
PyMem_RawFree(wstr);
|
||||
}
|
||||
else {
|
||||
/* strict mode */
|
||||
|
@ -3583,7 +3583,7 @@ decode_error:
|
|||
wstr = _Py_char2wchar(errmsg, &errlen);
|
||||
if (wstr != NULL) {
|
||||
reason = PyUnicode_FromWideChar(wstr, errlen);
|
||||
PyMem_Free(wstr);
|
||||
PyMem_RawFree(wstr);
|
||||
} else
|
||||
errmsg = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue