[Python-checkins] Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088)
zooba
webhook-mailer at python.org
Thu Jul 28 18:32:42 EDT 2022
https://github.com/python/cpython/commit/70068b933689ffc25397970553ae3bef559173fb
commit: 70068b933689ffc25397970553ae3bef559173fb
branch: main
author: Pamela Fox <pamela.fox at gmail.com>
committer: zooba <steve.dower at microsoft.com>
date: 2022-07-28T23:32:16+01:00
summary:
Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088)
files:
M Doc/c-api/unicode.rst
M Objects/unicodeobject.c
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 5d420bfa93cb2..339ee35c7aa47 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 7e3caf1af14c5..ad16ada16fe3b 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;
More information about the Python-checkins
mailing list