aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index f09205f63cc..8d4346cff3f 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1411,11 +1411,9 @@ static PyObject *
getargs_u(PyObject *self, PyObject *args)
{
Py_UNICODE *str;
- Py_ssize_t size;
if (!PyArg_ParseTuple(args, "u", &str))
return NULL;
- size = Py_UNICODE_strlen(str);
- return PyUnicode_FromUnicode(str, size);
+ return PyUnicode_FromWideChar(str, -1);
}
static PyObject *
@@ -1425,19 +1423,17 @@ getargs_u_hash(PyObject *self, PyObject *args)
Py_ssize_t size;
if (!PyArg_ParseTuple(args, "u#", &str, &size))
return NULL;
- return PyUnicode_FromUnicode(str, size);
+ return PyUnicode_FromWideChar(str, size);
}
static PyObject *
getargs_Z(PyObject *self, PyObject *args)
{
Py_UNICODE *str;
- Py_ssize_t size;
if (!PyArg_ParseTuple(args, "Z", &str))
return NULL;
if (str != NULL) {
- size = Py_UNICODE_strlen(str);
- return PyUnicode_FromUnicode(str, size);
+ return PyUnicode_FromWideChar(str, -1);
} else
Py_RETURN_NONE;
}
@@ -1450,7 +1446,7 @@ getargs_Z_hash(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "Z#", &str, &size))
return NULL;
if (str != NULL)
- return PyUnicode_FromUnicode(str, size);
+ return PyUnicode_FromWideChar(str, size);
else
Py_RETURN_NONE;
}
@@ -1902,10 +1898,6 @@ unicode_copycharacters(PyObject *self, PyObject *args)
return NULL;
}
- if (PyUnicode_READY(to) < 0) {
- return NULL;
- }
-
if (!(to_copy = PyUnicode_New(PyUnicode_GET_LENGTH(to),
PyUnicode_MAX_CHAR_VALUE(to)))) {
return NULL;
@@ -2298,7 +2290,7 @@ static int _pending_callback(void *arg)
{
/* we assume the argument is callable object to which we own a reference */
PyObject *callable = (PyObject *)arg;
- PyObject *r = PyObject_CallObject(callable, NULL);
+ PyObject *r = _PyObject_CallNoArg(callable);
Py_DECREF(callable);
Py_XDECREF(r);
return r != NULL ? 0 : -1;