diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_maskna.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index e121345b1..16e912c95 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -612,7 +612,7 @@ setArrayFromSequence(PyArrayObject *a, PyObject *s, int dim, npy_intp offset, npy_intp maskoffset) { Py_ssize_t i, slen; - int res = -1; + int res = 0; int a_has_maskna = PyArray_HASMASKNA(a); /* diff --git a/numpy/core/tests/test_maskna.py b/numpy/core/tests/test_maskna.py index 61fb7918e..393edf74d 100644 --- a/numpy/core/tests/test_maskna.py +++ b/numpy/core/tests/test_maskna.py @@ -45,6 +45,12 @@ def test_array_maskna_construction(): assert_equal(type(a), np.ndarray) assert_(np.isna(a)) + # The data type defaults to the same as an empty array if all is NA + a = np.array([np.NA], maskna=True) + b = np.array([]) + assert_equal(a.dtype, b.dtype) + assert_(np.isna(a)) + a = np.zeros((3,)) assert_(not a.flags.maskna) a = np.zeros((3,), maskna=True) |