Skip to content

Commit

Permalink
Merge pull request numpy#8103 from mattip/pypy-fixes
Browse files Browse the repository at this point in the history
Pypy fixes
  • Loading branch information
njsmith authored Oct 8, 2016
2 parents b0159a9 + 2f9f10a commit dbb7094
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 61 deletions.
21 changes: 21 additions & 0 deletions numpy/core/src/multiarray/scalartypes.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,15 @@ static PyObject *
}
/**end repeat**/

/**begin repeat
* #name = half, float, double, longdouble,
* cfloat, cdouble, clongdouble#
* #NAME = Half, Float, Double, LongDouble,
* CFloat, CDouble, CLongDouble#
*/
static PyNumberMethods @name@_arrtype_as_number;
/**end repeat**/

static PyObject *
bool_index(PyObject *a)
{
Expand Down Expand Up @@ -4094,6 +4103,18 @@ initialize_numeric_types(void)
Py@NAME@ArrType_Type.tp_as_number->nb_index = (unaryfunc)@name@_index;

/**end repeat**/

/**begin repeat
* #name = half, float, double, longdouble,
* cfloat, cdouble, clongdouble#
* #NAME = Half, Float, Double, LongDouble,
* CFloat, CDouble, CLongDouble#
*/
@name@_arrtype_as_number = gentype_as_number;
Py@NAME@ArrType_Type.tp_as_number = &@name@_arrtype_as_number;

/**end repeat**/

PyBoolArrType_Type.tp_as_number->nb_index = (unaryfunc)bool_index;

PyStringArrType_Type.tp_alloc = NULL;
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/shape.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ PyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape, int refcheck,
"Use the resize function or refcheck=False");

return NULL;
#else
#else
refcnt = PyArray_REFCOUNT(self);
#endif
#endif /* PYPY_VERSION */
}
else {
refcnt = 1;
Expand Down
Loading

0 comments on commit dbb7094

Please sign in to comment.