]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088)
authorPamela Fox <pamela.fox@gmail.com>
Thu, 28 Jul 2022 22:32:16 +0000 (15:32 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Jul 2022 22:32:16 +0000 (23:32 +0100)
Doc/c-api/unicode.rst
Objects/unicodeobject.c

index 5d420bfa93cb276129ebe8647d25d99d961a14ce..339ee35c7aa4747b1620c00d9a7112d7f9aa610c 100644 (file)
@@ -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.
index 7e3caf1af14c5b252aebb6cb1219f2e3bb423b4e..ad16ada16fe3bde8926f246f8a00ea2af8ffa9bb 100644 (file)
@@ -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;