summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index afa9dbc95..0207570da 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -810,7 +810,15 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
int swap;
type_num = descr->type_num;
- if ((type_num == PyArray_OBJECT)) {
+ /* XXX: Extra check is needed to allow this function to
+ XXX: be called to initialize bool values. It would
+ XXX: be better not to use this function in init. */
+ if (type_num == PyArray_BOOL && PyArrayScalar_True) {
+ int i = *(Bool*)data;
+ Py_INCREF(PyArrayScalar_BoolValues[i]);
+ return PyArrayScalar_BoolValues[i];
+ }
+ else if (type_num == PyArray_OBJECT) {
Py_INCREF(*((PyObject **)data));
return *((PyObject **)data);
}