summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/arrayobject.c11
-rw-r--r--numpy/core/src/scalarmathmodule.c.src27
2 files changed, 34 insertions, 4 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 73ca998b9..6d834df75 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -9123,8 +9123,17 @@ arraydescr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
conv = NULL;
if PyDict_Check(odescr)
conv = _convert_from_dict(odescr, 1);
- else if PyList_Check(odescr)
+ else if PyList_Check(odescr) {
conv = _convert_from_list(odescr, 1, 0);
+ if ((conv == NULL) &&
+ (!PyErr_Occurred())) {
+ PyErr_SetString(PyExc_ValueError,
+ "cannot specify align=1 "\
+ "with array_descriptor "\
+ "specification of the data-"\
+ "type.");
+ }
+ }
else if PyString_Check(odescr)
conv = _convert_from_commastring(odescr, 1);
else {
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index 1bbc34ba4..09cfc0b8d 100644
--- a/numpy/core/src/scalarmathmodule.c.src
+++ b/numpy/core/src/scalarmathmodule.c.src
@@ -764,12 +764,33 @@ static int
}
/**end repeat**/
+/**begin repeat
+ #name=(byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble)*3#
+ #Name=(Byte,UByte,Short,UShort,Int,UInt,Long,ULong,LongLong,ULongLong,Float,Double,LongDouble,CFloat,CDouble,CLongDouble)*3#
+ #cmplx=(,,,,,,,,,,,,,.real,.real,.real)*3#
+ #which=int*16,long*16,float*16#
+ #func=PyInt_FromLong*16,(PyLong_FromLongLong, PyLong_FromUnsignedLongLong)*5,PyLong_FromDouble*6,PyFloat_FromDouble*16#
+**/
+static PyObject *
+@name@_@which@(PyObject *obj)
+{
+ return @func@((PyArrayScalar_VAL(obj, @Name@))@cmplx@);
+}
+/**end repeat**/
+
/**begin repeat
- #name=(byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble)*5#
- #oper=int*16, long*16, float*16, oct*16, hex*16#
+ #name=(byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble)*2#
+ #oper=oct*16, hex*16#
**/
-#define @name@_@oper@ NULL
+static PyObject *
+@name@_@oper@(PyObject *obj)
+{
+ PyObject *pyint;
+ pyint = @name@_int(obj);
+ if (pyint == NULL) return NULL;
+ return PyInt_Type.tp_as_number->nb_@oper@(pyint);
+}
/**end repeat**/