diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 14:25:15 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 14:25:15 (GMT) |
commit | 1a7425f67a0d141483d89ca80ca01e3cb7f6be92 (patch) | |
tree | c5c3db81a3f0b754d3c7d2cfafd8609cba58142a /Objects/unicodeobject.c | |
parent | 51fa458d0a8fa6e9f583fc5a1c4164080093e763 (diff) | |
download | cpython-1a7425f67a0d141483d89ca80ca01e3cb7f6be92.zip cpython-1a7425f67a0d141483d89ca80ca01e3cb7f6be92.tar.gz cpython-1a7425f67a0d141483d89ca80ca01e3cb7f6be92.tar.bz2 |
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()
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ab1dbb9..3a4cc20 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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; } |