diff options
author | Inada Naoki <songofacandy@gmail.com> | 2020-06-30 03:23:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 03:23:07 (GMT) |
commit | b3332660adb02babb7e66e45310c66dc9a9a94da (patch) | |
tree | 4eb2b2e3e92d0821ddf20b286e995119d0ce1cb9 /Objects | |
parent | 2515a28230b1a011205f30263da6b01c6bd167a3 (diff) | |
download | cpython-b3332660adb02babb7e66e45310c66dc9a9a94da.zip cpython-b3332660adb02babb7e66e45310c66dc9a9a94da.tar.gz cpython-b3332660adb02babb7e66e45310c66dc9a9a94da.tar.bz2 |
bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c46ba4a..8eafdacf 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -15862,39 +15862,6 @@ unicode_iter(PyObject *seq) return (PyObject *)it; } -Py_UNICODE* -PyUnicode_AsUnicodeCopy(PyObject *unicode) -{ - Py_UNICODE *u, *copy; - Py_ssize_t len, size; - - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } -_Py_COMP_DIAG_PUSH -_Py_COMP_DIAG_IGNORE_DEPR_DECLS - u = PyUnicode_AsUnicodeAndSize(unicode, &len); -_Py_COMP_DIAG_POP - if (u == NULL) - return NULL; - /* Ensure we won't overflow the size. */ - if (len > ((PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(Py_UNICODE)) - 1)) { - PyErr_NoMemory(); - return NULL; - } - size = len + 1; /* copy the null character */ - size *= sizeof(Py_UNICODE); - copy = PyMem_Malloc(size); - if (copy == NULL) { - PyErr_NoMemory(); - return NULL; - } - memcpy(copy, u, size); - return copy; -} - - static int encode_wstr_utf8(wchar_t *wstr, char **str, const char *name) { |