mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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>
This commit is contained in:
parent
6067d4bc3c
commit
d5d9a71866
4 changed files with 63 additions and 55 deletions
17
Modules/clinic/arraymodule.c.h
generated
17
Modules/clinic/arraymodule.c.h
generated
|
|
@ -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]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue