From 70068b933689ffc25397970553ae3bef559173fb Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Thu, 28 Jul 2022 15:32:16 -0700 Subject: Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088) --- Doc/c-api/unicode.rst | 2 +- Objects/unicodeobject.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 5d420bf..339ee35 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -819,7 +819,7 @@ wchar_t Support most C functions. If *size* is ``NULL`` and the :c:type:`wchar_t*` string contains null characters a :exc:`ValueError` is raised. - Returns a buffer allocated by :c:func:`PyMem_Alloc` (use + Returns a buffer allocated by :c:func:`PyMem_New` (use :c:func:`PyMem_Free` to free it) on success. On error, returns ``NULL`` and *\*size* is undefined. Raises a :exc:`MemoryError` if memory allocation is failed. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7e3caf1..ad16ada 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2843,7 +2843,7 @@ PyUnicode_AsWideCharString(PyObject *unicode, } buflen = unicode_get_widechar_size(unicode); - buffer = (wchar_t *) PyMem_NEW(wchar_t, (buflen + 1)); + buffer = (wchar_t *) PyMem_New(wchar_t, (buflen + 1)); if (buffer == NULL) { PyErr_NoMemory(); return NULL; -- cgit v0.12