/*----- Header files ------------------------------------------------------*/
+#define PY_SSIZE_T_CLEAN
+
#include <Python.h>
#include <string.h>
DA_DESTROY(DA_V(me));
}
-static int da_pylength(PyObject *me)
+static Py_ssize_t da_pylength(PyObject *me)
{ return (DA_LEN(DA_V(me))); }
static int da_pytraverse(PyObject *me, visitproc proc, void *arg)
return (x);
}
-static PyObject *da_pyrepeat(PyObject *me, int times)
+static PyObject *da_pyrepeat(PyObject *me, Py_ssize_t times)
{
PyObject *x = da_new(&da_pytype);
PyObject **items = DA(DA_V(me)), **dest;
size_t n = DA_LEN(DA_V(me));
- int i;
+ Py_ssize_t i;
DA_ENSURE(DA_V(x), n * times);
DA_UNSAFE_EXTEND(DA_V(x), n * times);
return (x);
}
-static PyObject *da_pygetitem(PyObject *me, int i)
+static PyObject *da_pygetitem(PyObject *me, Py_ssize_t i)
{
PyObject *o;
return (o);
}
-static PyObject *da_pygetslice(PyObject *me, int i, int j)
+static PyObject *da_pygetslice(PyObject *me, Py_ssize_t i, Py_ssize_t j)
{
PyObject *x;
return (x);
}
-static int da_pyputitem(PyObject *me, int i, PyObject *x)
+static int da_pyputitem(PyObject *me, Py_ssize_t i, PyObject *x)
{
PyObject **p;
return (0);
}
-static int da_pyputslice(PyObject *me, int i, int j, PyObject *x)
+static int da_pyputslice(PyObject *me, Py_ssize_t i, Py_ssize_t j,
+ PyObject *x)
{ return (da_insert(me, x, i, j)); }
static int da_pycontainsp(PyObject *me, PyObject *x)
dstr d = DSTR_INIT;
PyObject *s, *rc = 0;
char *p;
- int n;
+ Py_ssize_t n;
size_t i;
dstr_puts(&d, "Array([");
RETURN_ME;
}
-static PyObject *da_pyiprepeat(PyObject *me, int times)
+static PyObject *da_pyiprepeat(PyObject *me, Py_ssize_t times)
{
PyObject **items, **dest;
size_t n = DA_LEN(DA_V(me));
- int i;
+ Py_ssize_t i;
if (times < 0) {
PyErr_SetString(PyExc_ValueError, "multiplier must be nonnegative");
static PyObject *da_pyget(PyObject *me, PyObject *index)
{
if (PySlice_Check(index)) {
- int start, stop, step, len;
+ Py_ssize_t start, stop, step, len;
PyObject *v;
PyObject **ww;
PyObject **vv;
static int da_pyput(PyObject *me, PyObject *index, PyObject *x)
{
if (PySlice_Check(index)) {
- int start, stop, step, len;
+ Py_ssize_t start, stop, step, len;
size_t n;
PyObject **ww;
PyObject **vv;
static PyObject *dameth_pop(PyObject *me, PyObject *arg)
{
- PyObject *x;
+ PyObject *x = Py_None;
if (!PyArg_ParseTuple(arg, ":pop")) return (0);
TRY
static PyObject *dameth_shift(PyObject *me, PyObject *arg)
{
- PyObject *x;
+ PyObject *x = Py_None;
if (!PyArg_ParseTuple(arg, ":shift")) return (0);
TRY