chiark
/
gitweb
/
~mdw
/
mLib-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
selpk.pyx: Fix bad cut-and-paste in the callback property.
[mLib-python]
/
array.c
diff --git
a/array.c
b/array.c
index 5ef0d4b4467856d7c782190f0d6e353136d96bda..d83f64e4f7b9ecf067803486a0d0bfeee67f3997 100644
(file)
--- a/
array.c
+++ b/
array.c
@@
-26,6
+26,8
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
+#define PY_SSIZE_T_CLEAN
+
#include <Python.h>
#include <string.h>
#include <Python.h>
#include <string.h>
@@
-257,7
+259,7
@@
static void da_pydealloc(PyObject *me)
DA_DESTROY(DA_V(me));
}
DA_DESTROY(DA_V(me));
}
-static
in
t 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 (DA_LEN(DA_V(me))); }
static int da_pytraverse(PyObject *me, visitproc proc, void *arg)
@@
-295,12
+297,12
@@
static PyObject *da_pyconcat(PyObject *me, PyObject *other)
return (x);
}
return (x);
}
-static PyObject *da_pyrepeat(PyObject *me,
in
t 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));
{
PyObject *x = da_new(&da_pytype);
PyObject **items = DA(DA_V(me)), **dest;
size_t n = DA_LEN(DA_V(me));
-
in
t i;
+
Py_ssize_
t i;
DA_ENSURE(DA_V(x), n * times);
DA_UNSAFE_EXTEND(DA_V(x), n * times);
DA_ENSURE(DA_V(x), n * times);
DA_UNSAFE_EXTEND(DA_V(x), n * times);
@@
-310,7
+312,7
@@
static PyObject *da_pyrepeat(PyObject *me, int times)
return (x);
}
return (x);
}
-static PyObject *da_pygetitem(PyObject *me,
in
t i)
+static PyObject *da_pygetitem(PyObject *me,
Py_ssize_
t i)
{
PyObject *o;
{
PyObject *o;
@@
-323,7
+325,7
@@
static PyObject *da_pygetitem(PyObject *me, int i)
return (o);
}
return (o);
}
-static PyObject *da_pygetslice(PyObject *me,
int i, in
t j)
+static PyObject *da_pygetslice(PyObject *me,
Py_ssize_t i, Py_ssize_
t j)
{
PyObject *x;
{
PyObject *x;
@@
-336,7
+338,7
@@
static PyObject *da_pygetslice(PyObject *me, int i, int j)
return (x);
}
return (x);
}
-static int da_pyputitem(PyObject *me,
in
t i, PyObject *x)
+static int da_pyputitem(PyObject *me,
Py_ssize_
t i, PyObject *x)
{
PyObject **p;
{
PyObject **p;
@@
-351,7
+353,8
@@
static int da_pyputitem(PyObject *me, int i, PyObject *x)
return (0);
}
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)
{ return (da_insert(me, x, i, j)); }
static int da_pycontainsp(PyObject *me, PyObject *x)
@@
-375,7
+378,7
@@
static PyObject *da_pyrepr(PyObject *me)
dstr d = DSTR_INIT;
PyObject *s, *rc = 0;
char *p;
dstr d = DSTR_INIT;
PyObject *s, *rc = 0;
char *p;
-
in
t n;
+
Py_ssize_
t n;
size_t i;
dstr_puts(&d, "Array([");
size_t i;
dstr_puts(&d, "Array([");
@@
-403,11
+406,11
@@
static PyObject *da_pyappend(PyObject *me, PyObject *seq)
RETURN_ME;
}
RETURN_ME;
}
-static PyObject *da_pyiprepeat(PyObject *me,
in
t times)
+static PyObject *da_pyiprepeat(PyObject *me,
Py_ssize_
t times)
{
PyObject **items, **dest;
size_t n = DA_LEN(DA_V(me));
{
PyObject **items, **dest;
size_t n = DA_LEN(DA_V(me));
-
in
t i;
+
Py_ssize_
t i;
if (times < 0) {
PyErr_SetString(PyExc_ValueError, "multiplier must be nonnegative");
if (times < 0) {
PyErr_SetString(PyExc_ValueError, "multiplier must be nonnegative");
@@
-432,7
+435,7
@@
static PyObject *da_pyiprepeat(PyObject *me, int times)
static PyObject *da_pyget(PyObject *me, PyObject *index)
{
if (PySlice_Check(index)) {
static PyObject *da_pyget(PyObject *me, PyObject *index)
{
if (PySlice_Check(index)) {
-
in
t start, stop, step, len;
+
Py_ssize_
t start, stop, step, len;
PyObject *v;
PyObject **ww;
PyObject **vv;
PyObject *v;
PyObject **ww;
PyObject **vv;
@@
-463,7
+466,7
@@
static PyObject *da_pyget(PyObject *me, PyObject *index)
static int da_pyput(PyObject *me, PyObject *index, PyObject *x)
{
if (PySlice_Check(index)) {
static int da_pyput(PyObject *me, PyObject *index, PyObject *x)
{
if (PySlice_Check(index)) {
-
in
t start, stop, step, len;
+
Py_ssize_
t start, stop, step, len;
size_t n;
PyObject **ww;
PyObject **vv;
size_t n;
PyObject **ww;
PyObject **vv;
@@
-518,7
+521,7
@@
static PyObject *dameth_push(PyObject *me, PyObject *arg)
static PyObject *dameth_pop(PyObject *me, PyObject *arg)
{
static PyObject *dameth_pop(PyObject *me, PyObject *arg)
{
- PyObject *x;
+ PyObject *x
= Py_None
;
if (!PyArg_ParseTuple(arg, ":pop")) return (0);
TRY
if (!PyArg_ParseTuple(arg, ":pop")) return (0);
TRY
@@
-545,7
+548,7
@@
static PyObject *dameth_unshift(PyObject *me, PyObject *arg)
static PyObject *dameth_shift(PyObject *me, PyObject *arg)
{
static PyObject *dameth_shift(PyObject *me, PyObject *arg)
{
- PyObject *x;
+ PyObject *x
= Py_None
;
if (!PyArg_ParseTuple(arg, ":shift")) return (0);
TRY
if (!PyArg_ParseTuple(arg, ":shift")) return (0);
TRY