summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Fox <pamela.fox@gmail.com>2022-07-28 22:32:16 (GMT)
committerGitHub <noreply@github.com>2022-07-28 22:32:16 (GMT)
commit70068b933689ffc25397970553ae3bef559173fb (patch)
treeb3bc6839c8a49ec52f16b798cf440c36c20fa72b
parent03da5d0f5b8c954d9b4d2ad837518dd605e60355 (diff)
downloadcpython-70068b933689ffc25397970553ae3bef559173fb.zip
cpython-70068b933689ffc25397970553ae3bef559173fb.tar.gz
cpython-70068b933689ffc25397970553ae3bef559173fb.tar.bz2
Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088)
-rw-r--r--Doc/c-api/unicode.rst2
-rw-r--r--Objects/unicodeobject.c2
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;