diff options
author | Inada Naoki <songofacandy@gmail.com> | 2020-05-11 06:37:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 06:37:25 (GMT) |
commit | d5d9a718662e67e2b1ac7874dda9df2d8d71d415 (patch) | |
tree | fb56aad14eba2825613b5ab59714c0ecfa60f85e /Modules/clinic/arraymodule.c.h | |
parent | 6067d4bc3ce5ff4cfa5b47ceecc84a3941bc031c (diff) | |
download | cpython-d5d9a718662e67e2b1ac7874dda9df2d8d71d415.zip cpython-d5d9a718662e67e2b1ac7874dda9df2d8d71d415.tar.gz cpython-d5d9a718662e67e2b1ac7874dda9df2d8d71d415.tar.bz2 |
bpo-36346: array: Don't use deprecated APIs (GH-19653)
* Py_UNICODE -> wchar_t
* Py_UNICODE -> unicode in Argument Clinic
* PyUnicode_AsUnicode -> PyUnicode_AsWideCharString
* Don't use "u#" format.
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Modules/clinic/arraymodule.c.h')
-rw-r--r-- | Modules/clinic/arraymodule.c.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h index e1f4b03..b9245ca 100644 --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -380,20 +380,23 @@ PyDoc_STRVAR(array_array_fromunicode__doc__, {"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__}, static PyObject * -array_array_fromunicode_impl(arrayobject *self, const Py_UNICODE *ustr, - Py_ssize_clean_t ustr_length); +array_array_fromunicode_impl(arrayobject *self, PyObject *ustr); static PyObject * array_array_fromunicode(arrayobject *self, PyObject *arg) { PyObject *return_value = NULL; - const Py_UNICODE *ustr; - Py_ssize_clean_t ustr_length; + PyObject *ustr; - if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) { + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("fromunicode", "argument", "str", arg); goto exit; } - return_value = array_array_fromunicode_impl(self, ustr, ustr_length); + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + ustr = arg; + return_value = array_array_fromunicode_impl(self, ustr); exit: return return_value; @@ -531,4 +534,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__, #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, -/*[clinic end generated code: output=f649fc0bc9f6b13a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9f70748dd3bc532f input=a9049054013a1b77]*/ |