summaryrefslogtreecommitdiff
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 2caa8ee5a8..464820d2af 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -236,7 +236,7 @@ BB_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
static PyObject *
u_getitem(arrayobject *ap, Py_ssize_t i)
{
- return PyUnicode_FromUnicode(&((Py_UNICODE *) ap->ob_item)[i], 1);
+ return PyUnicode_FromOrdinal(((Py_UNICODE *) ap->ob_item)[i]);
}
static int
@@ -1007,8 +1007,7 @@ ins(arrayobject *self, Py_ssize_t where, PyObject *v)
{
if (ins1(self, where, v) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1122,8 +1121,7 @@ array_array_remove(arrayobject *self, PyObject *v)
if (cmp > 0) {
if (array_del_slice(self, i, i+1) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else if (cmp < 0)
return NULL;
@@ -1185,8 +1183,7 @@ array_array_extend(arrayobject *self, PyObject *bb)
{
if (array_do_extend(self, bb) == -1)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1315,8 +1312,7 @@ array_array_byteswap_impl(arrayobject *self)
"don't know how to byteswap this array type");
return NULL;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1349,8 +1345,7 @@ array_array_reverse_impl(arrayobject *self)
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1445,7 +1440,7 @@ array_array_tofile(arrayobject *self, PyObject *f)
bytes = PyBytes_FromStringAndSize(ptr, size);
if (bytes == NULL)
return NULL;
- res = _PyObject_CallMethodId(f, &PyId_write, "O", bytes);
+ res = _PyObject_CallMethodIdObjArgs(f, &PyId_write, bytes, NULL);
Py_DECREF(bytes);
if (res == NULL)
return NULL;
@@ -1453,8 +1448,7 @@ array_array_tofile(arrayobject *self, PyObject *f)
}
done:
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1491,8 +1485,7 @@ array_array_fromlist(arrayobject *self, PyObject *list)
}
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1557,8 +1550,7 @@ frombytes(arrayobject *self, Py_buffer *buffer)
buffer->buf, n * itemsize);
}
PyBuffer_Release(buffer);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -1693,7 +1685,7 @@ array_array_tounicode_impl(arrayobject *self)
"tounicode() may only be called on unicode type arrays");
return NULL;
}
- return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, Py_SIZE(self));
+ return PyUnicode_FromWideChar((Py_UNICODE *) self->ob_item, Py_SIZE(self));
}
/*[clinic input]