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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index abc01614a..d66e01647 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -3038,12 +3038,13 @@ static Py_ssize_t
array_getcharbuf(PyArrayObject *self, Py_ssize_t segment, constchar **ptrptr)
{
if (self->descr->type_num == PyArray_STRING || \
- self->descr->type_num == PyArray_UNICODE)
+ self->descr->type_num == PyArray_UNICODE || \
+ self->descr->elsize == 1)
return array_getreadbuf(self, segment, (void **) ptrptr);
else {
PyErr_SetString(PyExc_TypeError,
- "non-character array cannot be interpreted "\
- "as character buffer");
+ "non-character (or 8-bit) array cannot be "\
+ "interpreted as character buffer");
return -1;
}
}