summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/_sortmodule.c.src3
-rw-r--r--numpy/core/src/arrayobject.c18
-rw-r--r--numpy/core/src/multiarraymodule.c8
-rw-r--r--numpy/core/src/scalarmathmodule.c.src3
-rw-r--r--numpy/core/src/ufuncobject.c3
-rw-r--r--numpy/core/src/umathmodule.c.src7
6 files changed, 12 insertions, 30 deletions
diff --git a/numpy/core/src/_sortmodule.c.src b/numpy/core/src/_sortmodule.c.src
index 2880dd0b1..4aa5962ee 100644
--- a/numpy/core/src/_sortmodule.c.src
+++ b/numpy/core/src/_sortmodule.c.src
@@ -464,9 +464,8 @@ static struct PyMethodDef methods[] = {
PyMODINIT_FUNC
init_sort(void) {
- PyObject *m;
- m = Py_InitModule("_sort", methods);
+ Py_InitModule("_sort", methods);
import_array();
add_sortfuncs();
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index bc662b7d1..3bc0cbf5d 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -1065,8 +1065,6 @@ _array_copy_into(PyArrayObject *dest, PyArrayObject *src, int usecopy)
static int
PyArray_CopyAnyInto(PyArrayObject *dest, PyArrayObject *src)
{
-
- intp size;
int elsize, simple;
PyArrayIterObject *idest, *isrc;
void (*myfunc)(char *, intp, char *, intp, intp, int);
@@ -1082,7 +1080,7 @@ PyArray_CopyAnyInto(PyArrayObject *dest, PyArrayObject *src)
return -1;
}
- if ((size=PyArray_SIZE(dest)) != PyArray_SIZE(src)) {
+ if (PyArray_SIZE(dest) != PyArray_SIZE(src)) {
PyErr_SetString(PyExc_ValueError,
"arrays must have the same number of elements"
" for copy");
@@ -2081,7 +2079,7 @@ slice_GetIndices(PySliceObject *r, intp length,
intp *start, intp *stop, intp *step,
intp *slicelength)
{
- intp defstart, defstop;
+ intp defstop;
if (r->step == Py_None) {
*step = 1;
@@ -2093,8 +2091,8 @@ slice_GetIndices(PySliceObject *r, intp length,
return -1;
}
}
+ /* defstart = *step < 0 ? length - 1 : 0; */
- defstart = *step < 0 ? length - 1 : 0;
defstop = *step < 0 ? -1 : length;
if (r->start == Py_None) {
@@ -5737,7 +5735,6 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
"offset", "strides",
"order", NULL};
PyArray_Descr *descr=NULL;
- int type_num;
int itemsize;
PyArray_Dims dims = {NULL, 0};
PyArray_Dims strides = {NULL, 0};
@@ -5775,7 +5772,6 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
if (descr == NULL)
descr = PyArray_DescrFromType(PyArray_DEFAULT);
- type_num = descr->type_num;
itemsize = descr->elsize;
if (itemsize == 0) {
@@ -7815,7 +7811,7 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags)
{
PyArrayObject *ret=NULL;
- int type, itemsize;
+ int itemsize;
int copy = 0;
int arrflags;
PyArray_Descr *oldtype;
@@ -7827,7 +7823,6 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags)
subtype = arr->ob_type;
if (newtype == NULL) {newtype = oldtype; Py_INCREF(oldtype);}
- type = newtype->type_num;
itemsize = newtype->elsize;
if (itemsize == 0) {
PyArray_DESCR_REPLACE(newtype);
@@ -9235,7 +9230,7 @@ static int
iter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,
PyArrayIterObject *val, int swap)
{
- int index, strides, itemsize;
+ int index, strides;
char *dptr;
PyArray_CopySwapFunc *copyswap;
@@ -9244,7 +9239,6 @@ iter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,
"boolean index array should have 1 dimension");
return -1;
}
- itemsize = self->ao->descr->elsize;
index = ind->dimensions[0];
strides = ind->strides[0];
dptr = ind->data;
@@ -9272,12 +9266,10 @@ iter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,
PyArray_Descr *typecode;
intp num;
PyArrayIterObject *ind_it;
- int itemsize;
int index;
PyArray_CopySwapFunc *copyswap;
typecode = self->ao->descr;
- itemsize = typecode->elsize;
copyswap = self->ao->descr->f->copyswap;
if (ind->nd == 0) {
num = *((intp *)ind->data);
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index 8d213c84a..7f526e18a 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -3710,7 +3710,7 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0,
NPY_CLIPMODE clipmode)
{
PyArrayObject *indices, *values;
- int i, chunk, ni, max_item, nv, tmp, thistype;
+ int i, chunk, ni, max_item, nv, tmp;
char *src, *dest;
int copied = 0;
@@ -3743,7 +3743,6 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0,
if (indices == NULL) goto fail;
ni = PyArray_SIZE(indices);
- thistype = self->descr->type_num;
Py_INCREF(self->descr);
values = (PyArrayObject *)PyArray_FromAny(values0, self->descr, 0, 0,
DEFAULT | FORCECAST, NULL);
@@ -3876,7 +3875,7 @@ static PyObject *
PyArray_PutMask(PyArrayObject *self, PyObject* values0, PyObject* mask0)
{
PyArrayObject *mask, *values;
- int i, chunk, ni, max_item, nv, tmp, thistype;
+ int i, chunk, ni, max_item, nv, tmp;
char *src, *dest;
int copied=0;
@@ -3914,9 +3913,8 @@ PyArray_PutMask(PyArrayObject *self, PyObject* values0, PyObject* mask0)
goto fail;
}
- thistype = self->descr->type_num;
values = (PyArrayObject *)\
- PyArray_ContiguousFromAny(values0, thistype, 0, 0);
+ PyArray_ContiguousFromAny(values0, self->descr->type_num, 0, 0);
if (values == NULL) goto fail;
nv = PyArray_SIZE(values); /* zero if null array */
if (nv <= 0) {
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index b574d2c4a..2caf9f6c0 100644
--- a/numpy/core/src/scalarmathmodule.c.src
+++ b/numpy/core/src/scalarmathmodule.c.src
@@ -1192,9 +1192,8 @@ static struct PyMethodDef methods[] = {
};
PyMODINIT_FUNC initscalarmath(void) {
- PyObject *m;
- m = Py_InitModule("scalarmath", methods);
+ Py_InitModule("scalarmath", methods);
import_array();
import_umath();
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c
index e707310fb..606cf1be8 100644
--- a/numpy/core/src/ufuncobject.c
+++ b/numpy/core/src/ufuncobject.c
@@ -1115,7 +1115,7 @@ static int
construct_arrays(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps,
PyObject *typetup)
{
- int nargs, i, maxsize;
+ int nargs, i;
int arg_types[NPY_MAXARGS];
PyArray_SCALARKIND scalars[NPY_MAXARGS];
PyUFuncObject *self=loop->ufunc;
@@ -1326,7 +1326,6 @@ construct_arrays(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps,
if (loop->size == 0) return nargs;
- maxsize = 0;
for (i=0; i<self->nargs; i++) {
loop->needbuffer[i] = 0;
if (arg_types[i] != mps[i]->descr->type_num ||
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src
index ba1521aeb..03e3a34d2 100644
--- a/numpy/core/src/umathmodule.c.src
+++ b/numpy/core/src/umathmodule.c.src
@@ -1279,15 +1279,10 @@ static void
{
intp i, is1 = steps[0], os = steps[1], n = dimensions[0];
char *i1 = args[0], *op = args[1];
- c@typ@ *x, *y;
- @typ@ xr, xi, xmag2;
+ c@typ@ *y;
for (i = 0; i < n; i++, i1 += is1, op += os) {
- x = (c@typ@ *)i1;
y = (c@typ@ *)op;
- xr = x->real;
- xi = x->imag;
- xmag2 = xr*xr + xi*xi;
y->real = 1.0;
y->imag = 0.0;
}